1

This is a really weird issue which I don't know where to find the solution.

Doing a POST request I could get the request parameters from "file_get_contents('php://input')". Also the $_SERVER variable is not empty. It contains data. But $_GET is always empty regardless if parameters exist in URL or not. $_SERVER["QUERY_STRING"] is also empty with GET request method.

I don't know how to solve this. I've tried to access $_GET in strict as well as non-strict mode. Same problem always. Could there be headers missing? This is my request and response below:

Remote Address:xxx.xxx.xx.xx:80
Request URL:http://local.mysite.com/?foo=bar
Request Method:GET
Status Code:200 OK

Response Headers
Access-Control-Allow-Credentials:true
Access-Control-Allow-Methods:GET, HEAD, POST, PUT, DELETE
Connection:keep-alive
Content-Encoding:gzip
Content-Type:application/json
Date:Wed, 15 Apr 2015 09:11:51 GMT
Server:nginx/1.4.6 (Ubuntu)
Transfer-Encoding:chunked
Vary:Accept-Encoding
X-Powered-By:HHVM/3.6.0-dev

Request Headers
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding:gzip, deflate, sdch
Accept-Language:sv-SE,sv;q=0.8,en-US;q=0.6,en;q=0.4,da;q=0.2,nb;q=0.2,de;q=0.2
Cache-Control:max-age=0
Connection:keep-alive
Host:local.mysite.com
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.118 Safari/537.36

Query String Parameters
foo:bar
musse1
  • 379
  • 4
  • 17

1 Answers1

0

Is it possible that you have a rewrite rule (i.e. something similar to mod_rewrite or mod_proxy) that is not populating the GET ?

Angel Iliikov
  • 710
  • 5
  • 8
  • That could be it! So simple... I actually have an Nginx conf which might be the problem. I will look into that. I hate when pulling my hair for such obvious error :) – musse1 Apr 15 '15 at 09:32
  • That's so dumb: "try_files $uri $uri/ /index.hh;". Thanks for pointing me in the right direction! Solution: "try_files $uri $uri/ /index.hh?$query_string;" – musse1 Apr 15 '15 at 09:34