Jump to content

[SOLVED] SimpleXML help


schilly

Recommended Posts

I'm trying to build a map according to where all my users live. Currently I am trying to generate a KML file of the users location by getting the geocode data from google using simple_xml_load. Going off this tutorial: http://code.google.com/apis/maps/articles/phpsqlgeocode.html#samplecode

 

My first few queries work ex. http://maps.google.com/maps/geo?output=xml&key=google_key&q=Vancouver%2C+BC%2C+Canada

 

but it dies when it hits: http://maps.google.com/maps/geo?output=xml&key=google_key&q=Montreal%2C+QC%2C+Canada

 

I get a warning error saying: parser error : Input is not proper UTF-8, indicate encoding ! Bytes: 0xE9 0x61 0x6C 0x2C

 

If I plug the url that doesn't work into my browser I get the proper response so I'm too sure why it would crap out. I'm not too familiar with the different string encoding types but the query strings are the exact format so not sure why it would complain.

 

Any help is appreciated. Let me know if you need any code. Thx.

Link to comment
https://forums.phpfreaks.com/topic/126856-solved-simplexml-help/
Share on other sites

Here is the response from google:

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.0">
<Response>
<name>Montreal,QC,Canada</name>
<Status>
<code>200</code>
<request>geocode</request>
</Status>
<Placemark id="p1">
<address>Montréal, QC, Canada</address>
<AddressDetails Accuracy="4" xmlns="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0">
<Country>
<CountryNameCode>CA</CountryNameCode>
<AdministrativeArea>
<AdministrativeAreaName>QC</AdministrativeAreaName>
<Locality>
<LocalityName>Montréal</LocalityName>
</Locality></AdministrativeArea></Country></AddressDetails>
<Point>
<coordinates>-73.639076,45.545447,0</coordinates>
</Point></Placemark></Response></kml>

 

I think it has something to do with the french character in Montreal.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.