PHP function to obtain remote web page content_PHP tutorial

WBOY
Release: 2016-07-21 15:44:34
Original
773 people have browsed it

$curDomain = $_SERVER['HTTP_HOST'];
$strHTML = file_get_contents('http://www.jb51.net/DomainParking.asp?gDomName='.$curDomain);
echo $strHTML
?>
I have seen on the Internet that file_get_contents is unstable, and I have encountered it. . .
On the other hand, it also shows that the fault tolerance of the program is very poor. . .
Well, let’s get down to business.
I encountered this error:
file_get_contents(http://***.php): failed to open stream: HTTP request failed!
After a while, I decided to use curl

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/320507.htmlTechArticle?php $curDomain = $_SERVER['HTTP_HOST']; $strHTML = file_get_contents('http://www .jb51.net/DomainParking.asp?gDomName='.$curDomain); echo $strHTML ? I have seen on the Internet that file_get...
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