title: Php save post headers to file to view later
body: <p>I am trying to view all of the pages headers and save them to file</p>
  
  <pre><code>file_put_contents("/var/www/rnli.hutber.com/controllers/api/location/post.json", json_encode($_POST));
  </code></pre>
  
  <p>This only outputs this however:</p>
  
  <pre><code>[]
  </code></pre>
  
  <p>But using another serivce I know there is a full post</p>
  
  <pre><code>Time: Tue, 07 Apr 15 09:36:37 -0700
  Source ip: 77.103.1.179
  
  Headers (Some may be inserted by server)
  REQUEST_URI = /post.php
  QUERY_STRING = 
  REQUEST_METHOD = POST
  GATEWAY_INTERFACE = CGI/1.1
  REMOTE_PORT = 34686
  REMOTE_ADDR = 77.103.1.179
  HTTP_USER_AGENT = Apache-HttpClient/UNAVAILABLE (java 1.4)
  HTTP_CONNECTION = close
  HTTP_HOST = posttestserver.com
  CONTENT_LENGTH = 201
  CONTENT_TYPE = application/json
  HTTP_ACCEPT = application/json
  UNIQUE_ID = VSQHldBx6hIAABF0UacAAAAF
  REQUEST_TIME_FLOAT = 1428424597.7112
  REQUEST_TIME = 1428424597
  
  No Post Params.
  
  == Begin post body ==
  {"auth_token":"hutber","test":"ing","location":{"latitude":"51.61755157","longitude":"-0.13905254","accuracy":"29.0","speed":"0.0","bearing":"0.0","altitude":"115.0","recorded_at":"2015-04-07T16:36Z"}}
  == End post body ==
  
  Upload contains PUT data:
  {"auth_token":"hutber","test":"ing","location":{"latitude":"51.61755157","longitude":"-0.13905254","accuracy":"29.0","speed":"0.0","bearing":"0.0","altitude":"115.0","recorded_at":"2015-04-07T16:36Z"}}
  </code></pre>
  
  <p><a href="http://posttestserver.com/data/2015/04/07/09.36.371974424473" rel="nofollow">http://posttestserver.com/data/2015/04/07/09.36.371974424473</a></p>