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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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