1

When I get in my server a HTTP request I get somthing like this:

 GET /my/page/home.php?arg1=1&arg2=2 HTTP/1.1
Host: mydomainname.com
Connection: keep-alive
Cache-Control: max-age=0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36
Accept-Encoding: gzip,deflate,sdch
Accept-Language: es-ES,es;q=0.8,en;q=0.6,de;q=0.4

What I want to know is how is the best way to pass all this info to PHP-CGI in a similar way apache2 does? This is my home.php file.

<?php
echo "Hello World\nGET:\n";
print_r($_GET);
echo "\n\nPOST:\n";
print_r($_POST);
echo "\n\nSERVER:\n";
print_r($_SERVER);

Thanks for your help

3
  • something like file_get_contents("php://input"); ? or apache_getenv() Commented Sep 18, 2014 at 23:35
  • Apache2 uses environment variables to pass these values to php-cgi. Commented Sep 18, 2014 at 23:36
  • Is there any tutorial or PHP documentation? What if I want to develop my own socket server? Commented Sep 18, 2014 at 23:47

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.