get lat/long here. http://rpc.geocoder.us/service/csv?address=3465+Henry+Drive,+Newbury+Park,+CA,+91320"; print_r($directions); print ""; function getDirections($source_address, $destination_address) { global $mapsurl; global $map; $source_address = preg_replace("| |", "%20", $source_address); $destination_address = preg_replace("| |", "%20", $destination_address); $data = file("$mapsurl?saddr=$source_address&daddr=$destination_address"); // Line 3 contains the xml structure with the directions on it $segments = $data[2]; $data = null; $segments = preg_replace("|^.*.*$|", "", $segments); $segments = preg_replace("||", "", $segments); $segments = preg_replace("||", "", $segments); parseSegments($segments); return $map; } function parseSegments($segments) { global $segsFound; global $mapOfSegments; global $characterData; global $map; // reset elements $segsFound = 0; $mapOfSegments = array(); $dataFound = 0; $characterData = array(); $map = array(); $xml_parser = xml_parser_create(); xml_set_element_handler($xml_parser, "startElement", "endElement"); xml_set_character_data_handler($xml_parser, "characterDataFunction"); if (!xml_parse($xml_parser, $segments)) { die(sprintf("XML error: %s at line %d", xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser))); } xml_parser_free($xml_parser); $map = $mapOfSegments[0]; $map['STEPS'] = array_splice($mapOfSegments, 1, count($mapOfSegments)); // Map character data into array for($i=0; $i