[thelist] condensing 4 regexes to 1?

der wert derwert at hotmail.com
Sat Aug 5 19:26:34 CDT 2006

you use selectors "(abc)(def)(ghi)"



$myurl = "http://maps.google.co.uk/maps?q=ab106qr&output=js";

$myhtml = getURL($myurl);

$pattern = '/center: \{lat: ([-]?[0-9]{1,3}\.[0-9]{6}),lng: 

preg_match($pattern, $myhtml , $matches);
echo "latitude: ".$matches[1]." longitude: ".$matches[2];

function getURL($popped){
$fail = "failed";
$remote = @fopen ($popped, "rb");
if (!$remote){
     print($popped." FAILED");
     return $fail;

     $html = "";
     do {
         $data = fread($remote, 8192);
         if (strlen($data) == 0) {
         $html .= $data;
         } while(true);
     fclose ($remote);
     return $html;



On 8/5/06, Alex Beston <alex.beston at gmail.com> wrote:
>Hi evolters
>http://www.markbarton.com/blog/articles/FAST-6E8BQF contains a hack to
>get the post code out of a gmap's url output and mentions it can be
>parsed out. this is  a proof of concept for a mashup im making rather
>than an actual attempt to rip off google, so bear with me.

Express yourself instantly with MSN Messenger! Download today - it's FREE! 

More information about the thelist mailing list