Saturday, February 24, 2007

Scrape Web Page script



//

function getRSS($xml_url)
{
$handle = @fopen($xml_url, "r");
if ($handle)
{
while (!feof($handle))
{
$buffer.= fgets($handle, 4096);
}
fclose($handle);
}
return $buffer;
}
//

With this PHP script, you can extract all of the HTML information of any web page and store it in a variable. From there, you can cut it and find certain parts of it to use how ever you like. The way you use this script for extracting web page content is your responsibility.
To call the function and store it in a variable you type this:
< ?php
$variable = getRSS("http://www.google.com");
? >

1 comment:

Poll - Email Script said...

Its highly informative. I would be visiting your blog hereafter regularly to gather valuable information.
Real Estate Script