Hello all,
Just wanted to thank any of you in advance if you could provide some routes to take on this..
I am using (more or less) the code found at http://code.google.com/support/bin/answ ... opic=11364
to interact with requests a user sends (they are just brought over by http post).
There is just one form field, and my script processes the input to geolocate an address.
Point 1) I check first if the address entered was geogached in my geocache, and if not, I attempt to take each term
of the address, and ask google (with a 3 second delay between each term to avoid throttling etc) if that particular term is valid.
Point 2) Thus I arrive at the largest concatenated string possible that is a
'valid' address by google. The reason i do this on a term basis, and
not on a full address basis, is that the user may enter a restaurant
name (which would return an error reaching out to the maps.google.com/
geo url as it's not a valid address). i think this might not be
important though but I felt i'd add it. So "applebees main street
anytown, NJ" i'd arrive at google telling me "main street anytown, NJ"
is valid.
The Problem:
At any rate, What I notice is about 45% of the time I get an error:
failed to open stream: HTTP request failed! (in my eventvwr logs)
and then the xml doc cannot load the external entity (thus my function stops working because the simplexml_load_file failed).
If i try again, and again, (maybe 2-3 times) it'll work and i'll get
the address I wanted.
I understand the php.ini file contains the entry for allow_url_fopen,
however I turned this on (and if it was off, it would never work i
believe as opposed to partially)
one important thing I want to mention is that I was initially using
curl for this operation, and i was randomly getting the same problem
(where it wouldn't return me a result). It's weird, i've tried both CSV and XML format for google and randomly
it just fails. Any suggestions? I'm completely out of ideas and am so frustrated!
If i take (at any given point) the very same string and manually try in a browser, it works every time. I'm also logging the URL that is trying to be used and trying that manually as well and it works every time.
Obviously I understand I can check in with google about this and i'm in the process of doing so, however does anyone know anything about odd/esoteric server/php settings that could randomly cause my efforts to reach out to read information to fail?
Regards,
Mike
simplexml_load_file Options
Moderator: General Moderators