简体   繁体   中英

PHP Crawling Methods

任何人都可以告诉我,如果curl无法在PHP中进行爬网,那么将使用哪种方法进行爬网?

If you are referring to creating a spider to crawl entire remote sites the way utilities like wget can, I don't believe cURL has that capability. cURL would be used to make the requests and download each page, but you have to create the logic in your PHP script to parse the content of the pages, extract the links, and create a list of URLs to crawl. cURL doesn't do that part for you.

CURL can:

  1. Follow redirect (set up as option)
  2. Store content (->curl_exec())

This is all your need to crawl. Used common methods, take examples from http://ua2.php.net/manual/en/function.curl-exec.php

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM