Try this function in place 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 just like file_get_contents(), but uses cURL.
Install cURL on Ubuntu (or other unix-like operating system with aptitude):
sudo apt-get install php5-curl
sudo /etc/init.d/apache2 restart
See also cURL
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…