时间:2021-07-01 10:21:17 帮助过:12人阅读
方法三:
代码如下:
$url="http://www.baidu.com";
$fp=fopen($url,"r");
$response = '';
while($row = fgets($fp)) {
$response.= trim($row)."\n";
}
注意:如果ping的通但是无法调用远程url,试试wget
代码如下:
Resolving www.xxx.com... 114.xxx.xxx.xxx
Connecting to www.xxx.com|114.xxx.xxx.xxx|:80... connected.
HTTP request sent, awaiting response... 403 Forbidden
10:58:22 ERROR 403: Forbidden.
这样就不可以!