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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.