Red little fat snoopy Snoopy class usage example

WBOY
Release: 2016-07-29 08:37:52
Original
1135 people have browsed it

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.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!