請幫我解決我的代碼如何解決fsockopen錯誤?
$fp = fsockopen("projecthoneypot.org/statistics.php", 80, $errno, $errstr, 5);
if ($fp) {
$url = "/";
fputs($fp, "GET $url HTTP/1.1\r\nHost: {projecthoneypot.org/statistics.php}\r\nConnection: close\r\n\r\n");
$resp = '';
while(!feof($fp)) {
$resp .= fgets($fp, 1024);
}
echo "$resp";
}
我總是得到這個錯誤
Warning: fsockopen() [function.fsockopen]: php_network_getaddresses: getaddrinfo failed: Name or service not known in /home/xxx/public_html/xxx.php on line 3
Warning: fsockopen() [function.fsockopen]: unable to connect to projecthoneypot.org\statistics.php:80 (php_network_getaddresses: getaddrinfo failed: Name or service not known) in /home/xxx/public_html/xxx.php on line 3
有什麼問題嗎?
可能重複的問題:[php_network_getaddresses:失敗的getaddrinfo:產品名稱或服務不知道(http://stackoverflow.com/questions/2661546/php-network-getaddresses -getaddrinfo-failed-name-or-service-not-known) – Wiseguy
謝謝Wiseguy – Maroman