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