Hello, I try to use part of the example http://openlayers.org/dev/examples/openls.html to include a map in my website and let users search for the address. But I alway get a null-value as response.responseXML. To verify that I have no error in my code I have copied the whole example to my site. Calling it shows the same error as the code in my own site (for the example see code below). I found a posting in an OSM-forum that I have to use a proxy and so I have installed proxy.php from the mapbuilder-site and changed the code like follows:
The alert in function requestSuccess(response) returns null whatever I set as proxy. I have tried with "", "proxy.php", "proxy.php?url=", all with the same result. The only diffenrence ist that with "" there are about 5 seconds from calling the service until I get the result. In all other cases (using the proxy.php) the result comes in less than one second. What is wrong in my code? (I also tried to use proxy.cgi, but this won't work on my server - I get an 500 internal-server-error) Thank you for all tipps! asked 29 Dec '11, 21:04 s_glodek SimonPoole ♦ |
Are you sure that your proxy script is working? You can test this by pointing your normal browser to http://localhost/proxy.php?url=http://a.tile.openstreetmap.org/0/0/0.png Your proxy script needs to support POST as well as GET. You may want to open the debuging tools in your browser and see what requests get sent and what error messeges you get from them. answered 30 Dec '11, 01:11 Gnonthgol ♦ Jippiyeah!! I have it!! The error ist the Content-Type: application/xml in the POST-request. I changed it to "Content-Type: application/x-www-form-urlencodedrn" and now it works! Thanks to Gnonthgol for the hint to use the debug-tools of the browser and to google to find a posting with a short description to send a post in php :-).
(31 Dec '11, 12:32)
s_glodek
|
Please use the OpenLayers proxy.cgi explained here: http://trac.osgeo.org/openlayers/wiki/FrequentlyAskedQuestions#ProxyHost The normal OpenLayers proxy.cgi already contains the OpenRouteService host. See here: http://trac.osgeo.org/openlayers/browser/trunk/openlayers/examples/proxy.cgi Please beware that the proxy script has the right permission to execute! Hope that helps :) answered 30 Dec '11, 08:34 pascal_n I'm not able to use proxy.cgi - it always returns 500 - server error. Using proxy.php I can see with firebug that proxy.php sends the following request:
The answer from www.openrouteservice.org is
It seems to be an error in transferring the POST-data. The proxy.php-script is available as text-file on http://osm.glodek-edv.de/proxy.txt and the test-site is http://osm.glodek-edv.de/openls.html
(31 Dec '11, 12:09)
s_glodek
|