Hello PHP Guros,
I am trinig to fetch webpage.
If i tried this code:
$fp = fsockopen("sport.maktoob.com", 80, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br />\
";
} else {
$out = "GET / HTTP/1.1\\r\
";
$out .= "Host:sport.maktoob.com";
$out .= "Connection: Close\\r\
\\r\
";
fwrite($fp, $out);
$buffer = '';
while (!feof($fp)) {
$buffer .= fgets($fp, 128);
}
fclose($fp);
}
It’s work fine
But when i tried this code:
$fp = fsockopen("helwa.maktoob.com", 80, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br />\
";
} else {
$out = "GET / HTTP/1.1\\r\
";
$out .= "Host:helwa.maktoob.com";
$out .= "Connection: Close\\r\
\\r\
";
fwrite($fp, $out);
$buffer = '';
while (!feof($fp)) {
$buffer .= fgets($fp, 128);
}
fclose($fp);
}
It’s failed
I know that maybe this webpage (helwa.maktoob.com) located on other server that allow_url_fopen=off.
how can parse and fetch webpage from this subdomain ??
Regards,
Sam