In the following snippet, I'm trying to open and read a URL into the variable $contents. I'd like to use preg_replace() to return only part of that string beginning with say - regional and ending with new - but I get the complete URL string returned.
Thank you for any assistance. Tony Ritter ............................... <? $theurl="http://weather.noaa.gov/pub/data/summaries/regional/ny/albany.txt"; if (!($fp=fopen($theurl, "r"))) { echo "Could not open the URL."; exit; } $contents=fread($fp, 1000000); $newtext= preg_replace("/.*?(regional.*new).*/","1",$contents); fclose($fp); echo $newtext; ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php