PHPSnoopy class library

Source: Internet
Author: User
The PHPSnoopy class library snoopy is a php class used to imitate the functions of a web browser. it can complete the tasks of obtaining webpage content and sending forms.

Official website http://snoopy.sourceforge.net/

Snoopy can complete the following functions:

1. capture webpage content 2. capture webpage text (remove HTML code) 3. webpage capturing hyperlink 4. support for proxy servers 5. support for basic user/password authentication mode 6. support for custom user agents, referer, cookies and header content 7. support browser redirection and control redirection depth 8. extend links in webpages to high-quality URLs (default) 9. easy data submission and return value 10. support for tracking HTML frameworks (added in v0.92) 11. support for passing cookies when redirection is supported.

Snoopy application ---

1. use the fetch method to obtain HTML webpage content

Fetch ("http://www.jlu.edu.cn"); $ line = $ snoopy-> results; print_r ($ line);?>

2. use fetchtext to convert the HTML webpage content returned by the server to plain text content

Fetchtext ("http://www.jlu.edu.cn"); $ line = $ snoopy-> results; print_r ($ line);?>

3. use fetchform to obtain the name and target address of the form's sending text box.

Fetchform ("http://www.jlu.edu.cn"); $ line = $ snoopy-> results; print_r ($ line);?>

4. use fetchlinks to capture webpage hyperlinks

Fetchlinks ("http://www.jlu.edu.cn"); print_r ($ snoopy-> results);?>

5. automatic registration

$ Submit_vars ["user_name"] = "yourname"; $ submit_vars ["user_password"] = "yourpwd"; $ submit_vars ["confirm_password"] = "yourpwd "; $ submit_vars ["email"] = youremail@gmail.com; $ submit_vars ["Submit"] = "register"; $ snoopy-> submit ($ submit_url, $ submit_vars ); print $ snoopy-> results;?>

6. capture and display the webpage source code

Maxframes = 5000; // you can set the number of bytes to capture $ snoopy-> fetch ("http://www.jlu.edu.cn/"); echo"

\n"; for($i=0;$i<$snoopy->maxframes;$i++){ echo htmlentities($snoopy->results[$i]); } echo "
\ N ";?>

Http://hi.baidu.com/aseashell/blog/item/b9840726f039fa0b908f9dee.html

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.