当前位置:首页 > PHP教程 > PHP高级教程

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

<?php
$curdomain = $_server['http_host'];
$strhtml = file_get_contents('http://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

【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:)!