I found this content retrieval example on phpbuilder and it works fine. thanks. what i need help with is just printing the surrounded content and not the start and stop points the code uses to select the content.
the tip is here: http://www.phpbuilder.com/tips/item.php?id=113
<?php
$url = 'http://waterdata.usgs.gov/nv/nwis/uv?13162225';
$lines_array = file($url);
$lines_string = implode('', $lines_array);
eregi("Discharge, cubic feet per second(.*)<img src=\"/nwisweb/data/img/", $lines_string, $head);
$lines = split("\n", $head[0]);
$x = count($lines);
for ($i=0;$i<$x;$i++) {
echo $lines[$i];
}
/** The explanation
* 1. Specified the url (or the page) that we will gonna retrieve
* 2. Store the whole code into array called $lines_array
* 3. We parse *the content from $lines_array into $lines_string
* 4. We 'cut' the whole code with an eregi function.. in this case we want to take *the information which is start from the
* <!--http://www.php.net/--> until ended with <!-- end body -->. How do I know this ??
* Check the HTML source from php.net =)
* 5. Split them into new array.. in this case we split them with a newline character
* 6. and
* 7. We loop the whole array and write it into our HTML source.
*/
?>
I don't want to print: Discharge, cubic feet per second
or: "/nwisweb/data/img/
or whatever bit of content I'm using to mark the content I want.
thanks.