Snoopy is a PHP class that is used to imitate the functions of a web browser. It can complete the tasks of obtaining web content and sending forms.
The following are some of its features:
1. Convenient to crawl the content of the webpage
2. Convenient to crawl the text of the webpage (remove HTML code)
3. Convenient to crawl the links of the webpage
4. Support proxy host
5. Support Basic user/password authentication mode
6. Support custom user agent, referer, cookies and header content
7. Support browser redirection and control the redirection depth
8. Can expand links in web pages into high-quality URLs (Default)
9. Convenient to submit data and get the return value
10. Support tracking HTML framework (added in v0.92)
11. Support passing cookies when redirecting
Please see the instructions in the download file for specific usage.
Copy the code The code is as follows:
include "Snoopy.class.php";
$snoopy = new Snoopy;
$snoopy->fetchform("http://www. phpx.com/happy/logging.php?action=login");
print $snoopy->results;
< ?php
include "Snoopy.class.php";
$snoopy = new Snoopy;
$submit_url = "http://www.phpx.com/happy/logging.php?action=login";
$submit_vars["loginmode"] = "normal";
$submit_vars["styleid"] = "1";
$submit_vars["cookietime"] = "315360000";
$submit_vars["loginfield"] = "username";
$submit_vars["username"] = "********"; //Your user Name
$submit_vars["password"] = "*******"; //Your password
$submit_vars["questionid"] = "0";
$submit_vars["answer"] = "";
$submit_vars["loginsubmit"] = "Submit";
$snoopy->submit($submit_url,$submit_vars);
print $snoopy->results;
?>
The above has introduced a small example of using the Snoopy class, including the content of Snoopy. I hope it will be helpful to friends who are interested in PHP tutorials.