Jump to content

JavaScript Proxy Host


Tondo

Recommended Posts

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  :confused: 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

Link to comment
https://forums.phpfreaks.com/topic/250635-javascript-proxy-host/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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