Thursday, July 29, 2010

http request to check if adress is valid

Hello,

I use simplexml_load_file() to request the kml data of an specific
adress to check if the adress exists. on my local host, this method
works fine. but when i try to use it on my webserver, the request
failes with the following errors:

Warning: simplexml_load_file(http://maps.google.com/maps/geo?q=[ZIP]+
[STREET]+[CITY]+DE&output=xml&sensor=false&key=[KEY])
[function.simplexml-load-file]: failed to open stream: Connection
timed out

Warning: simplexml_load_file() [function.simplexml-load-file]: I/O
warning : failed to load external entity "http://maps.google.com/maps/
geo?q=[ZIP]+[STREET]+[CITY]+DE&output=xml&sensor=false&key=[KEY]
"

I asked my provider and according to him, nothing is blocked on the
server. I also tried to use different api-keys (one for domain.com,
one for www.domain.com) but nothing helped.

Is it possible, that the request is blocked, because it comes from the
registration form?

Heres my php code:

$data = array('q' => $this->form->getValue('zip').' '.$this->form-
>getValue('address').' '.$this->form->getValue('city').' DE');

$req = 'http://maps.google.com/maps/
geo?'.http_build_query($data).'&output=xml&oe=utf8&sensor=false&key='.sfConfig::get('app_sfGMaps_key')
;
echo $req.'<br/>';

$rawXml = simplexml_load_file($req);
echo var_dump($rawXml);

Thanks alot for your replies.

--
You received this message because you are subscribed to the Google Groups "Google Maps API" group.
To post to this group, send email to google-maps-api@googlegroups.com.
To unsubscribe from this group, send email to google-maps-api+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-maps-api?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate