Home  >  Article  >  Backend Development  >  Code for php file_get_contents function to capture page information

Code for php file_get_contents function to capture page information

WBOY
WBOYOriginal
2016-07-25 09:04:151077browse
  1. $url="http://bbs.55bbs.com";
  2. $contents=@file_get_contents($url);
  3. //preg_match_all("/

    (.*?)

    /is",$contents,$content);
  4. preg_match_all("/

    (.*?)

    /is",$contents ,$content);
  5. print_r($content[0]);
  6. ?>
Copy code

For more complex page crawling, you can consider using the curl method. For details, you can refer to the following articles: How to use CURL to forge IP source in PHP php code for using curl to determine whether a remote file exists php uses curl to fake IP source code php simulated login to qq mailbox (detailed explanation of curl command) php curl learning summary curl command simulates form upload file In addition, for the usage of php file_get_contents function, you can refer to the following articles: php file_get_contents function proxy obtains the code of the remote page Problems using the php file_get_contents function The relationship between PHP-CGI process CPU 100% and file_get_contents function Examples of POST data using socket, curl, file_get_contents methods http://www.w3school.com.cn/php/func_filesystem_file_get_contents.asp



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