0

I try to login on Geoserver using php. i do:

$geoserverURL = "http://localhost:8080/geoserver/j_acegi_security_check";

$post = http_build_query(array(
        "username" => $username,
        "password" => $password,
));

$context = stream_context_create(array("http"=>array(
    "method" => "POST",
    "header" => "Content-Type: application/x-www-form-urlencoded\r\n" .
            "Content-Length: ". strlen($post) . "\r\n",
    "content" => $post,
)));

$page = file_get_contents($geoserverURL, false, $context);
echo $page;

But not see any activity in FireBug. I'm new with php, so maybe i do something wrong here? This code snipet i was found here.

Kliver Max
  • 5,107
  • 22
  • 95
  • 148
  • You seem to have a misunderstanding on what PHP is how that code gets executed. You'll need to track with what server side code is before you'll get anywhere. PHP code runs on the server, not in your browser, so you're not going to see anything in Firebug. See this question for a bit more info: http://stackoverflow.com/questions/7407374/client-side-vs-server-side-basics – Brad Peabody Aug 26 '13 at 06:36

2 Answers2

0

Can you try without port?? For example:

$geoserverURL = "http://localhost/geoserver/j_acegi_security_check";
  • Without port i get error: `Warning: file_get_contents(http://localhost/geoserver/j_acegi_security_check): in D:\xampp\htdocs\rest\index.php on line 64`. So if i understand right its mean that with port file_get_contents() see requered page? – Kliver Max Aug 26 '13 at 06:42
0

you won't see it in firebug cause firebug logs events that have place on your side (client) that mean in your browser. You could track this if you would use ajax then firebug would log it

If you want to check a track of it use tool to control your network for example WireShark. There you will be able to log this request

if you need to use login and password I would recomend you to use cURL. It is much better IMO

Fixus
  • 4,631
  • 10
  • 38
  • 67
  • @KliverMax if you don't get any response I would guess problem with url, port or something like that. First of all you need to check if your request is pointing good url and do you have any response at all – Fixus Aug 26 '13 at 07:56