问题描述:之前Yii框架我们用fsockopen异步调用url来同步一些数据,代码如下
$fp = fsockopen ( $hostname, $port, $errno, $errstr, 600 );
stream_set_blocking ( $fp, 0 ); //开启非阻塞模式
fputs ( $fp, "GET " . $url . "\r\n" );
fclose ( $fp );
但是是webman中就会出现一下错误提示:
ErrorException: fsockopen(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /home/www/webman/app/utils/Curl.php:55
Stack trace:
如果用其它方法,该怎么异步调用url呢?
php_network_getaddresses: getaddrinfo failed: Name or service not known
报错很明显,$hostname 无法解析,把 $hostname 打印出来看下是啥
感谢大佬,找到原因了,域名没有配置好