On Sep 12, 10:32 am, 83maxi <[EMAIL PROTECTED]> wrote:
> $key="ABQIAAAANSQxmkxcvpr2RxcJYtti9RQM4XXGVHQaHneEl1euNmGB9_TT2xRkFSJuNM2HVufL2G1FwYR2Yfyt6w";
> $empresa=new Empresa();
>
> while($empresa->listar())
> {
> $direccion= $empresa->getDireccion();
> $direccion=strtolower($direccion);
> $address = "http://maps.google.com/maps/geo?q=
> $direccion&output=xml&key=$key";
>
> echo $address;
>
> // Retrieve the URL contents
> $page = file_get_contents($address);
>
> // Parse the returned XML file
> $xml = new SimpleXMLElement($page);
>
> // Retrieve the desired XML node
> $coordenadas =
> explode(",",$xml->Response->Placemark->Point->coordinates);
>
> echo $coordenadas[0] ."-". $coordenadas[1];;
> echo "<br>";
>
> }
>
> errors
>
> http://maps.google.com/maps/geo?q=11+avenida+joan+miro,+palma+de+mall...
> Warning: SimpleXMLElement::__construct() [simplexmlelement.--
> construct]: Entity: line 1: parser error : Start tag expected, '<' not
> found in C:\xampp\htdocs\nicgrup\scriptgoogle.php on line 142
>
> Warning: SimpleXMLElement::__construct() [simplexmlelement.--
> construct]: {"name":"11 avenida joan miro, palma de mallorca","Status":
> {"code":200,"request" in C:\xampp\htdocs\nicgrup\scriptgoogle.php on
> line 142
>
> Warning: SimpleXMLElement::__construct() [simplexmlelement.--
> construct]: ^ in C:\xampp\htdocs\nicgrup\scriptgoogle.php on line 142
>
> Fatal error: Uncaught exception 'Exception' with message 'String could
> not be parsed as XML' in C:\xampp\htdocs\nicgrup\scriptgoogle.php:142
> Stack trace: #0 C:\xampp\htdocs\nicgrup\scriptgoogle.php(142):
> SimpleXMLElement->__construct('{"name":"11 ave...') #1 {main} thrown
> in C:\xampp\htdocs\nicgrup\scriptgoogle.php on line 142
>
> why???
What about "String could not be parsed as XML" don't you understand?
http://www.google.com/search?sourceid=gmail&q=String%20could%20not%20be%20parsed%20as%20XML
This is not a problem with the Google Maps API, it is a problem with
the PHP Xml parser, probably due to character encoding
inconsistencies...
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---