private function fetchUrl($url)
{
$response = '';
if (ini_get('allow_url_fopen')) {
$ctx = stream_context_create(array('http' => array('follow_location' => 0, 'timeout' => 5)));
$response = @file_get_contents($url, null, $ctx);
}
if (!$response && function_exists('curl_init')) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$response = curl_exec($ch);
curl_close($ch);
}
return (string) $response;
}