Page 1 of 1

Extracting text from a remote web page

Posted: Fri May 31, 2002 2:31 pm
by terrym
Hi.
I have a requirement to extract certain text from a remote Web Page.
I want to extract Meta Keywords, Meta Description, text between H2 tags, and some general Body text.
I have tried XML HTTP Request object, but I cannot get the example (from jibbering.com) to work.
Would this be difficult, or does someone know an easy (?) way to do this?

Posted: Fri May 31, 2002 4:00 pm
by enygma
grab the page ( with a file() maybe?) and then just regexp out what you need....

Posted: Sat Jun 01, 2002 6:35 am
by riley
I get the latest incentives directly from chevrolet with this code.
[syntax=php]<?php
$site = "http://www.chevrolet.com/cur_offers/pri ... h_east.htm";
$open = fopen($site, "r");
$search = fread($open, 50000);
fclose($open);
$search = ereg("SOUTH EAST(.*)", $search, $content);
$content[1] = str_replace(" ", " ", $content[1]);
$content[1] = str_replace("href=", "", $content[1]);
echo $content[1];

?>[/syntax]