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
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.