急问:fsockopen函数提示php_network_getaddresses错误

seeu1688 2004-08-07 10:34:47
提示的出错信息如下:
<br />
<b>Warning</b>: fsockopen(): php_network_getaddresses: getaddrinfo failed: Name or service not known in <b>/home/www/tmp_test/socket.htm</b> on line <b>2</b><br />
<br />
<b>Warning</b>: fsockopen(): unable to connect to www.php.net:80 in <b>/home/www/tmp_test/socket.htm</b> on line <b>2</b><br />
Resource temporarily unavailable (11)<br>

程序是php官方帮助的例程,如下:

<?php
$fp = fsockopen ("www.php.net", 80, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br>\n";
} else {
fputs ($fp, "GET / HTTP/1.0\r\nHost: www.php.net\r\n\r\n");
while (!feof($fp)) {
echo fgets ($fp,128);
}
fclose ($fp);
}
?>

系统的运行环境如下:
PHP Version 4.3.4

System Linux datagather 2.4.20-8smp #1 SMP Thu Mar 13 17:45:54 EST 2003 i686
Build Date Aug 6 2004 18:10:13
Configure Command './configure' '--with-gd=/usr/local' '--with-mysql=/usr' '--with-apache=../apache' '--enable-ftp' '--enable-track-vars'
Server API Apache
Virtual Directory Support disabled
Configuration File (php.ini) Path /usr/local/Zend/etc/php.ini
PHP API 20020918
PHP Extension 20020429
Zend Extension 20021010
Debug Build no
Thread Safety disabled
Registered PHP Streams php, http, ftp

请问这是什么问题造成的,谢谢
...全文
501 点赞 收藏 3
写回复
3 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
xkchz 2004-08-09
应该是第一位所说的那样,域名没解释出来
回复
52juanjuan 2004-08-09
应该是地址或者端口的不正确, 虽然是官方网站他提供的只是一个例子实际工作时肯定要写上正确的地址与端口号才能正确的连接.
回复
ezdevelop 2004-08-09
are you sure that your nameserver is running and setup correctly?
回复
发帖
基础编程
创建于2007-09-28

2.1w+

社区成员

从PHP安装配置,PHP入门,PHP基础到PHP应用
申请成为版主
帖子事件
创建了帖子
2004-08-07 10:34
社区公告
暂无公告