title: Accessing posted Json data in php script
body: <p>I'm using the <a href="https://github.com/rmccue/Requests" rel="noreferrer">Requests for PHP</a> library to POST some json data to another PHP script (I'm using Laravel's Response::json method to generate the json output:</p>
  
  <pre><code>public function postIndex()
  {
      $input = Input::get();
      $data = Response::json($input);
      $url = 'http://mydomain.com/emails/events';
      $response = Requests::post($url, array('Content-Type' =&gt; 'application/json'), $data);
      return $response-&gt;status_code;
  }
  </code></pre>
  
  <p>I need the script on the receiving end (<a href="http://mydomain.com/emails/events" rel="noreferrer">http://mydomain.com/emails/events</a>) to decode and process the json, but I'm having a hard time accessing it. I setup a simple test script that emails me the contents of $_POST, but it comes up empty every time.</p>
  
  <pre><code>$post_data = print_r($_POST,true);
  mail("my@email.com","post data",$post_data);
  </code></pre>
  
  <p>What am I doing wrong here?</p>