Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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

1 Answer 1

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.

<?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;
?>

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

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

Source: http://osgeo-org.1560.n6.nabble.com/proxy-and-apache-tp3912603p3912617.html

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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