Forum Moderators: martinibuster
$google_ad_handle = @fopen(google_get_ad_url(), 'r');
if ($google_ad_handle) {
while (!feof($google_ad_handle)) {
echo fread($google_ad_handle, 8192);
}
fclose($google_ad_handle);
} function curl_get_contents($url, $timeout=60) {
$timeout = abs((int)$timeout);
$curl = curl_init();
$opts = array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => $timeout
);
curl_setopt_array($curl, $opts);
$result = curl_exec($curl);
if($result === false){
user_error(curl_error($curl));
return false;
}
$response = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if($response != 200){
user_error("Received HTTP response of $response.");
}
return $result;
}
$url= google_get_ad_url();
$contents = curl_get_contents($url);
echo $contents;