Catfish Posted March 10, 2010 Share Posted March 10, 2010 <?php $idArray = array('IDQ10090'); foreach($idArray as $value) { print($value); $forecastData = preg_replace('/.*<pre>/', '', file_get_contents('http://www.bom.gov.au/cgi-bin/wrap_fwo.pl?'.$value.'.txt')); $forecastData = preg_replace('/<\/pre>.*/', '', $forecastData); print($forecastData); } ?> I want the data from the URL that is between the <pre> </pre> tags only. This code is removing the tags only, and not all the characters before and after it. I think the newline character is being used as a limit point for the .* meta-characters, but I don't know how to remove this limitation/function? Quote Link to comment Share on other sites More sharing options...
salathe Posted March 10, 2010 Share Posted March 10, 2010 Use the s pattern modifier (/.../s) to allow the dot meta character to match newlines. Quote Link to comment Share on other sites More sharing options...
Catfish Posted March 10, 2010 Author Share Posted March 10, 2010 thanks for the help Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.