Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a problem to display WFS layer outside the Geoserver. My code working fine in geoserver, but when I tried my code in wampserver(PHP), only WMS layer is being to displayed.

I gone through many tutorial and stack overflow queries related to adding WFS layer in openlayer but nothing working in my case...I have also tried proxy.cgi scripts to allow proxy call to geoserver, but it not works. Is CGI proxy script can be used only with Python or it can be used with PHP as well?

share|improve this question
have you tried using a PHP proxy file? – Devdatta Tengshe Apr 1 '13 at 7:28
could you please help me : I want to show postgres query output in openlayer using php.? – user37155 Sep 18 '14 at 10:15
This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. You can also add a bounty to draw more attention to this question once you have enough reputation. – Martin Sep 18 '14 at 10:37
If you have a new question, please ask it by clicking the Ask Question button. Include a link to this question if it helps provide context. – Brad Nesom Sep 18 '14 at 12:38

You need a PHP proxy. This is a simple proxy.php script. It will be completely open, and you might want to lock it down.

 $ch = curl_init($_GET['url']);
 curl_setopt($ch, CURLOPT_HEADER, 0);
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
 $output = curl_exec($ch);
 echo $output;

In your OpenLayers JavaScript config point to you proxy.php script with the following:

OpenLayers.ProxyHost = "proxy.php?url=";


share|improve this answer
Thanks for replay Devdatta Tengshe!! I have tried this but its not working. Do I have to make some changes in conf file or some any other file. – user2189282 Apr 1 '13 at 11:21
What do you mean when you say it is not working? Are you getting any errors in Firebug? – Devdatta Tengshe Apr 1 '13 at 14:08
Firebug not showing any error only WMS layer is being displayed means WFS layer is still missing. – user2227374 Apr 1 '13 at 22:59
If firebug's console is not showing any error that means the problem is somewhere else. Is the request atleast being sent? (See in the net tab of firebug) – Devdatta Tengshe Apr 2 '13 at 1:27

protected by Aaron May 22 '15 at 19:28

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.