Blog | added news scraping from google to junglescene

added news scraping from google to junglescene

it was pretty easy to do the code is contained in the article:

$newsout =" " ;

$src = 'http://news.google.com/';

$found = 0;

$skip = 1;

$i = 1;

$fp = fopen ($src, " r" );

while ((!feof ($fp)) && (!$found))

{

$line = fgets($fp, 4096);

$line = strreplace(" src=/" ," src=http://news.google.com/" ," $line" );

$line = strreplace(" $line = strreplace(" /a> " ," " ," $line" );

$line = strreplace(" href=/" ," href=http://news.google.com/" ," $line" );

$line = strreplace(" style=cursor:hand;" ," " ," $line" );

$line = strreplace("  " ," " ," $line" );

$line = strreplace("  " ," " ," $line" );

$line = striptags (" $line" ," " );

$i = ++$i;

if ($i > 110)

{

$newsout .= $line;

}

}

fclose($fp);

Subscribe

Metadata

Post date:

Sunday, September 29th, 2002 at 3:02:15 PM

Tags