Phpfile_get_contents function code for capturing page information

Source: Internet
Author: User
Phpfile_get_contents function code for capturing page information

  1. $ Url = "http://bbs.55bbs.com ";
  2. $ Contents = @ file_get_contents ($ url );
  3. // Preg_match_all ("/

    (.*?) <\/P>/is ", $ contents, $ content );

  4. Preg_match_all ("/(.*?) <\/H3>/is ", $ contents, $ content );
  5. Print_r ($ content [0]);
  6. ?>

For more complex page crawling, you can consider using the curl method. for details, refer to the following article: PHP uses CURL to forge the IP source. php uses curl to determine whether a remote file exists. php uses curl to forge the IP source code. php simulates logon to the QQ mailbox (detailed explanation of the curl Command) php curl learning summary the curl Command simulates form upload files. In addition, for usage of the php file_get_contents function, refer to the following articles: php file_get_contents function proxy get remote page code php file_get_contents function use problem PHP-CGI process CPU 100% and file_get_contents function relationship php use socket, curl, file_get_contents method POST data instance http://www.w3school.com.cn/php/func_filesystem_file_get_contents.asp

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.