Snoopy application (Introduction)

Source: Internet
Author: User

Snoopy is a PHP class used to simulate browser functions. It can obtain webpage content and send forms.
: Http://sourceforge.net/projects/snoopy/
Some features of Snoopy:
1. Fetch the webpage content
2. fetchtext
3. Capture the link of the web page, form fetchlinks fetchform
4. Support for proxy hosts
5. basic user name/password verification is supported.
6. You can set user_agent, Referer, cookies, and header content)
7. Supports browser redirection and can control the depth of redirection.
8. Extend the link in the webpage to a high-quality URL (default)
9. submit data and obtain the returned value
10. Support tracking HTML framework
11. Transfer cookies when redirection is supported
You only need PhP4 and above. Because it is a PHP class, you do not need to expand the support. The best choice is when the server does not support curl.

Class method:

Fetch ($ URI)
----
This method is used to capture the content of a webpage.
$ URI is the URL of the webpage to be crawled.
The captured results are stored in $ this-> results.
If you are capturing a framework, Snoopy will track each frame and store it in an array, and then save it to $ this-> results.

Fetchtext ($ URI)
-----
This method is similar to fetch (). The only difference is that this method will remove HTML tags and other irrelevant data and only return the text content in the webpage.

Fetchform ($ URI)
-----
This method is similar to fetch (). The only difference is that this method will remove the HTML Tag and other irrelevant data and only return the Form Content (form) in the webpage ).

Fetchlinks ($ URI)
------
This method is similar to fetch (). The only difference is that this method will remove HTML tags and other irrelevant data and only return links in the webpage ).
By default, the relative link is automatically completed and converted to a complete URL.

Submit ($ Uri, $ formvars)
--------
This method sends a confirmation form to the URL specified by $ URL. $ Formvars is an array that stores form parameters.

Submittext ($ Uri, $ formvars)
---------
This method is similar to submit (). The only difference is that this method will remove HTML tags and other irrelevant data and only return the text content on the webpage after login.

Submitlinks ($ URI)
------
This method is similar to submit (). The only difference is that this method will remove HTML tags and other irrelevant data and only return links in the webpage ).
By default, the relative link is automatically completed and converted to a complete URL.

class properties: (the default value is in brackets)
$ host connected host
$ port connected port
$ proxy_host proxy host used, if yes,
$ proxy_port indicates the proxy host port used, if yes
$ Agent user proxy disguise (Snoopy v0.1)
$ referer information, if
$ cookies exist, if yes
$ rawheaders, other header information. If yes
$ maxredirs maximum redirect times, 0 = not allowed (5)
$ offsiteok whether or not to allow redirects off-site. (true)
$ expandlinks: whether to add all links to the full address (true)
$ User: The authenticated user name. If yes,
$ pass: The authenticated user name, if yes,
$ accept HTTP accept type (image/GIF, image/X-xbitmap, image/JPEG, image/pjpeg ,*/*)
$ Error, if
$ response_code returns a response from the server Code
$ headers returns header information from the server
$ maxlength maximum returned Data Length
$ read_timeout read operation timeout (requires PHP 4 beta 4 +)
set to 0 to no timeout
$ timed_out if a read operation times out, this attribute returns true (requires PHP 4 beta 4 +)
$ maxframes maximum number of frames that can be tracked
$ HTTP status captured by status
$ temp_dir temporary file directory (/tmp) that can be written by the webpage Server)
$ curl_path curl binary directory. If no curl binary is available, set it to false.

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.