File_get_contents only reads part of the webpage content. In fact, this is the simplest and most primitive method for collecting articles. File_get_contents only reads part of the webpage content. In fact, this is the simplest and most primitive method for collecting articles.
Script ec (2); script
In the php tutorial
The file_get_contents function can open local files or read remote files.
Usage
File_get_contents ($ url );
Let's take a look at the example of file_get_contents collecting remote website content.
| The Code is as follows: |
|
|
$ Url = http://www.111cn.net
$ Content = file_get_contents ($ url );
If ($ content)
{
$ Array = explode ('', $ Content); print_r ($ array); </p>
}
Else
{
Echo 'collection not successful ';
}
// If the output is successful
Array (
0 => webpage creation tutorial-webpage design tutorial-professional Webpage Design and webpage creation tutorials
) |
All right.
You can use functions such as fsockopen and fopen (allow_url_open needs to be set) to read remote server content.