title: ASIHTTPRequest post json to php server
body: <p>I have been trying to post a json object to a PHP script for the last 5 hours.  I have read all the docs and it seems the code should work BUT it does not.  The request is made and received ok, but I can't access the posted json data or dont even know if its been sent correctly.  I keep getting an empty php array, instead of the json data.</p>
  
  <pre><code>NSString *jsonString = [self.tableDataSource JSONRepresentation];
  
  NSURL *url = [NSURL URLWithString:@"http://myserver.com/test.php"];
  ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
  
  
  [request addRequestHeader:@"User-Agent" value:@"ASIHTTPRequest"]; 
  [request addRequestHeader:@"Content-Type" value:@"application/json"];
  [request appendPostData:[jsonString  dataUsingEncoding:NSUTF8StringEncoding]]; 
  [request startSynchronous];
  </code></pre>
  
  <p>here is the php script (test.php)</p>
  
  <pre><code>$handle = fopen('php://input','r');
  $jsonInput = fgets($handle);
  $decoded = json_decode($jsonInput,true);
  print_r($decoded);
  </code></pre>
  
  <p>I am using the lastest ASIHttpRequest code from <a href="https://github.com/pokeb/asi-http-request.git" rel="noreferrer">https://github.com/pokeb/asi-http-request.git</a></p>
  
  <p>What am I doing wrong?????</p>
  
  <p>Cheers,
  Trav.</p>