Look very hard at
>$address =
>"http://maps.google.com/maps/geo?q=$direccion&output=xml&key=$key";
line.
The clue is in
__construct('{"name":"11 ave...') #1
bit.
(hint: entities)
On Fri, Sep 12, 2008 at 6:32 PM, 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+mallorca&output=xml&key=ABQIAAAANSQxmkxcvpr2RxcJYtti9RQM4XXGVHQaHneEl1euNmGB9_TT2xRkFSJuNM2HVufL2G1FwYR2Yfyt6w
> 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???
>
>
>
> >
>
--
Barry
- www.nearby.org.uk - www.geograph.org.uk -
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---