I´m trying to get the info of a page, but it looks impossible

I´m trying to get the info of a page like that http://hardgamerz.com:9665 with PHP.

I tryed with

[php]file_get_contents(“http://hardgamerz.com:9665”);[/php]

but get stuck loading, and in the end it shous the Max execution time passed…

I tryed with hardgamerz.com or other sites and works. I don´t know what´s goin on.

I hope somebody can help me, please.

Thanks.

try this

[php]
function get_url_contents($url){
$crl = curl_init();
$timeout = 5;
curl_setopt ($crl, CURLOPT_URL,$url);
curl_setopt ($crl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($crl, CURLOPT_CONNECTTIMEOUT, $timeout);
$ret = curl_exec($crl);
curl_close($crl);
return $ret;
}

$res = get_url_contents(“http://hardgamerz.com:9665”);

print($res);
[/php]

Sir, I must say you are a PHP master.

Thanks :smiley:

It works.

Sponsor our Newsletter | Privacy Policy | Terms of Service