Why use of session name and session id in the get variables does not work?

Posted by Roman on Stack Overflow See other posts from Stack Overflow or by Roman
Published on 2012-06-23T14:42:26Z Indexed on 2012/06/23 15:16 UTC
Read the original article Hit count: 172

Filed under:
|
|
|

I have the following code:

$location .= 'red=no&'.session_name() . "=". session_id();
$content = file_get_contents($location);
echo $content;

If I run it, noting is displayed in my browser. However, if I modify it in the following way:

$location .= 'red=no';
$content = file_get_contents($location);
echo $content;

everything works fine (I see the content in my browser).

What is also strange, if I display the value of the $location variable from the first example (url) and manually paste it in the address line of my browser, I do see the content. So, my browser is able to use this URL and file_get_contents not.

Does anybody know how it can be explained?

© Stack Overflow or respective owner

Related posts about php

Related posts about session