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

WBOY
Release: 2016-06-01 12:22:46
Original
900 people have browsed it

$curDomain = $_SERVER['HTTP_HOST'];
$strHTML = file_get_contents('http://www.bitsCN.com/DomainParking.asp?gDomName='.$curDomain);
echo $strHTML
?>
早就在网上看到说file_get_contents不稳定,果然碰到了。。。
另一方面也说明了程序的容错性很差啊。。。
恩,言归正传吧。
碰到的是这个错误:
file_get_contents(http://***.php): failed to open stream: HTTP request failed!
G一下,决定用curl

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!