Anthony2oo4
03-10-2007, 10:02 PM
Im trying to learn regular expressions, and as an example im trying to get the miles from the google maps page. Here is the code I have:
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://maps.google.co.uk/maps?f=d&hl=en&saddr=m3&daddr=m2');
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($ch);
curl_close($ch);
preg_match("/timedist ul\042>(.*)/s",$data,$newresults);
echo "<textarea rows=\"24\" name=\"f\" cols=\"119\">".$data."</textarea>";
print_r ($newresults);
?>
But seems to return a blank array. Can anybody explain wht:
/timedist ul\042>(.*)/s
Cant get the number. In the source file the code is:
timedist ul\042>0.7
I simply want the scrip to get the number 0.7 from there lol.
thanks for your time.
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://maps.google.co.uk/maps?f=d&hl=en&saddr=m3&daddr=m2');
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($ch);
curl_close($ch);
preg_match("/timedist ul\042>(.*)/s",$data,$newresults);
echo "<textarea rows=\"24\" name=\"f\" cols=\"119\">".$data."</textarea>";
print_r ($newresults);
?>
But seems to return a blank array. Can anybody explain wht:
/timedist ul\042>(.*)/s
Cant get the number. In the source file the code is:
timedist ul\042>0.7
I simply want the scrip to get the number 0.7 from there lol.
thanks for your time.