Try this function instead of file_get_contents ():
<?php function curl_get_contents($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_URL, $url); $data = curl_exec($ch); curl_close($ch); return $data; }
It can be used in the same way as file_get_contents (), but uses cURL.
Install cURL on Ubuntu (or another unix-like operating system with aptitude):
sudo apt-get install php5-curl sudo /etc/init.d/apache2 restart
See also cURL
source share