<?phpclass LongLat{ // {{{ public static function getCoord /** * Get Coords * * This function retrieves the coords of a givent url. * * @param string $type The type, either longitude or latitude * @param string $content The content of the page to parse. * @return string The value of the parsed content. */ public static function getCoord($type, $content) { switch (strtolower($type)) { case 'longitude': case 'latitude': $type = (string)$type; } preg_match("/<dd class=\"$type\">(.*[^>])<\/dd>/", $content, $values, PREG_OFFSET_CAPTURE); if (is_array($values) && isset($values[1][0])) { preg_match("/\((.*[^\)])\)/", $values[1][0], $lastvalues, PREG_OFFSET_CAPTURE); if (is_array($lastvalues) && isset($lastvalues[1][0])) { return (string)$lastvalues[1][0]; } } return 'none'; } // }}}}// }}}$latitude = '';$longitude = '';$content = file_get_contents("http://www.multimap.com/map/browse.cgi?client=public&search_result=&db=pc&keepicon=true&lang=&pc=cm16%206rp&advanced=&client[equal%20tongue]ublic&addr2=&quicksearch=cm16%206rp&addr3=&addr1=");$latitude = LongLat::getCoord('latitude', $content);$longitude = LongLat::getCoord('longitude', $content);echo "Latitude: $latitude\n";echo "Longitude: $longitude";?>