当前位置: 移动技术网 > IT编程>开发语言>PHP > php 获取远程网页内容的函数

php 获取远程网页内容的函数

2019年05月04日  | 移动技术网IT编程  | 我要评论
<?php
$curdomain = $_server['http_host'];
$strhtml = file_get_contents('//www.jb51.net/domainparking.asp?gdomname='.$curdomain);
echo $strhtml
?>
早就在网上看到说file_get_contents不稳定,果然碰到了。。。
另一方面也说明了程序的容错性很差啊。。。
恩,言归正传吧。
碰到的是这个错误:
file_get_contents(http://***.php): failed to open stream: http request failed!
g一下,决定用curl

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网