Home >Backend Development >PHP Tutorial >php gets the content under the address through the web page address php gets the web page content php gets the web page source code php opens the network

php gets the content under the address through the web page address php gets the web page content php gets the web page source code php opens the network

WBOY
WBOYOriginal
2016-07-29 08:52:051910browse

Method 1 (For PHP5 and above ):

$readcontents = fopen( http://www.phpres. com/index.html", "rb");

$contents = stream_get_contents( $readcontents);

fclose($readcontents);

echo $contents;

Method 2:

echo file_get_contents("http://www.phpres.com/index.html");

Example:

The above introduces how PHP obtains the content under the address through the web address, including the web address and PHP content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
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