Tondo Posted November 7, 2011 Share Posted November 7, 2011 Hi there, I'm noob, not even sure I've chosen correct section. I'm supposed to create a simple map client via JavaScript. I found OpenLayers library so I jumped in, but I get stuck... As far I know JavaScript needs some kind of proxy host to allow access to remote server Here's better explanation http://trac.osgeo.org/openlayers/wiki/FrequentlyAskedQuestions#ProxyHost The solution they suggest is to copy their .cgi script, modify it if needed, place proxy.cgi to Apache cgi-bin dir and set OpenLayers.ProxyHost = "cgi-bin/proxy.cgi?url="; I'm running this on Win 7 32bit Ultimate, virtual drive (don't ask me why) and for reasons unknown I was unable to handle that cgi script. Couldn't I done this by using PHP? Let's say: <?php $ch = curl_init($_GET['url']); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $output = curl_exec($ch); curl_close($ch); echo $output; ?> I placed proxy.php to apache default public docs directory - htdocs - with my html file. But it doesn't work. Is there any way to include that php script into html file so the OpenLayers.ProxyHost property can be set? If yes, please, could you tell me where should/shouldn't I place that php script? How should OpenLayers.ProxyHost input look like? Thank you very much. Tom Quote Link to comment https://forums.phpfreaks.com/topic/250635-javascript-proxy-host/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.