sorry for the title, just not sure what to call the function help i need, lol
Anyways.
I Have got a script that grabs data and displays it, the script works fine except for when the $grab_end part is different to the defined value.
Code: Select all
<?php
$query = ($_SERVER['QUERY_STRING']);
$length = "260";
$grab_start = "METAR $query";
$grab_end = "TAF TAF $query";
$xurl = "http://www.airservices.gov.au/brief/html.asp?/cgi-bin/avreq?area=21";
$read = file_get_contents($xurl);
$grab = eregi("$grab_start(.*)$grab_end", $read, $metgrab);
$metgrab[1] = str_replace("TAF TAF AMD", "TAF TAF $query", $metgrab[1]);
trim($metgrab[1]);
$long = strlen($metgrab[1]);
if ($long < $length) {
echo "<pre>$query $metgrab[1]</pre>";
}
else { echo "<pre>$query $metgrab[1]</pre>"; }
if ($_SERVER['QUERY_STRING'] == false) {
echo "<center>No METAR station code has been selected, Please press back in your browser."; }
?>Now the script works fine if the $grab_end that is defined is the one in use. ie. using the url http://www.canberra-wx.com/metgrab.php?YSCB ...
The script reads the query string, parses the document ($xurl) for the Match at $grab_start and $grab_end and then displays the info i want.
how ever using the url http://www.canberra-wx.com/metgrab.php?YGLBYSCB 130630Z 33008KT 9999 FEW030 09/04 Q1021 RMK
RF00.0/000.0 USE TAF FOR ARRIVALS AFTER 0800Z NOSIG
display nothing because in this case the part i need it to end is TAF TAF AMD and the $grab_end is set for TAF TAF.
As you can see i tried a work around with the str_replace but this fails.
any help on getting $grab_end to use either TAF TAF AMD and TAF TAF or any other fix for the problem would be great.
thx in advanced![/b]