Snoopy is a PHP class that simulates a web browser. It automates the
task of retrieving web page content and posting forms, for example.
Some of Snoopy's features:
* easily fetch the contents of a
web page
* easily fetch the text from a web page (strip html tags)
* easily fetch the the links from a web page
* supports proxy hosts
* supports basic user/pass authentication
* supports setting
user_agent, referer, cookies and header content
* supports browser
redirects, and controlled depth of redirects
* expands fetched links to
fully qualified URLs (default)
* easily submit form data and retrieve the
results
* supports following html frames (added v0.92)
* supports
passing cookies on redirects (added v0.92)
/*======================================================================*\
Function: fetch
Purpose: fetch the contents of a web page
(and
possibly other protocols in the
future like ftp, nntp, gopher, etc.)
Input: $URI the location of the page to fetch
Output:
$this->results the output text from the fetch
/*======================================================================*\
Function: submit
Purpose: submit an http form
Input: $URI the
location to post the data
$formvars the formvars to use.
format:
$formvars["var"] = "val";
$formfiles an array of files to submit
format: $formfiles["var"] = "/dir/filename.ext";
Output:
$this->results the text output from the post
/*======================================================================*\
Function: fetchlinks
Purpose: fetch the links from a web page
Input: $URI where you are fetching from
Output: $this->results an
array of the URLs
/*======================================================================*\
Function: fetchform
Purpose: fetch the form elements from a web page
Input: $URI where you are fetching from
Output: $this->results
the resulting html form
/*======================================================================*\
Function: fetchtext
Purpose: fetch the text from a web page,
stripping the links
Input: $URI where you are fetching from
Output:
$this->results the text from the web page
/*======================================================================*\
Function: submitlinks
Purpose: grab links from a form submission
Input: $URI where you are submitting from
Output: $this->results
an array of the links from the post
/*======================================================================*\
Function: submittext
Purpose: grab text from a form submission
Input: $URI where you are submitting from
Output: $this->results
the text from the web page
/*======================================================================*\
Function: set_submit_multipart
Purpose: Set the form submission
content type to
multipart/form-data
/*======================================================================*\
Function: set_submit_normal
Purpose: Set the form submission content
type to
application/x-www-form-urlencoded
http://sourceforge.net/projects/snoopy