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
Release: 2016-07-29 08:52:05
Original
1922 people have browsed it

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.

Related labels:
php
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