|
作者darkangel
你有沒把 HEAD 改成 HTTP Request GET 試過?
我記得取 errno 與 errstr 應該不需要用到 reference。
我三四年沒碰 PHP 了,以下寫法沒測試過,你自己試吧。
$domain = "www.pcdvd.com.tw";
$port = 80;
$timeout = 30;
$out = "GET / HTTP/1.1\r\n";
$out .= "Host: $domain\r\n";
$out .= "Connection: Close\r\n\r\n";
$fp = fsockopen ($domain, $port, $errno, $errstr, $timeout);
fputs ($fp, $out);
while (!feof($fp)) { echo fgets ($fp,128); }
fclose ($fp);
|