title: PHP break 'file_get_contents' into array
body: <p>In my ios app code i'm passing a NSDictionary inside HTTPBody
  so my php can check if user exist in database.</p>
  
  <pre><code>-(void)checkUser
      {
        NSDictionary *userDict = [NSDictionary dictionaryWithObjectsAndKeys:
        sessionId, @"sessionId",
        sessionName, @"sessionName",
        nil];
  
        NSData *jsonData = [NSJSONSerialization dataWithJSONObject:userDict
                          options:NSJSONWritingPrettyPrinted error:nil];
        NSString *jsonString = [[NSString alloc] initWithData:jsonData
        encoding:NSUTF8StringEncoding];
  
        // initialize and open the stream
        NSURL *url = [NSURL URLWithString:@"http://www.mysite.com/userValidate.php"];
        NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url];
        [request setHTTPMethod:@"POST"];
        [request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
        [request setHTTPBody:[jsonString dataUsingEncoding:NSUTF8StringEncoding]];
  
        [NSURLConnection connectionWithRequest:request delegate:self];
      }
  </code></pre>
  
  <p>in the PHP file im usig</p>
  
  <pre><code>$raw = file_get_contents('php://input');
  </code></pre>
  
  <p>and getting back</p>
  
  <pre><code>post = "{\n \"sessionId\" : \"132156\",\n \"sessionName\" : \"My Name\"\n}";
  </code></pre>
  
  <p>I followed this post <a href="https://stackoverflow.com/a/5078426/1333294">https://stackoverflow.com/a/5078426/1333294</a> and add this method to my PHP file</p>
  
  <pre><code>    function getTestPostData()
      {
       $post_data = explode( "\n", file_get_contents('php://input') );
       $result = array();
  
       foreach( $post_data as $post_datum ) {
           $pair = explode(":", $post_datum );
           $result[urldecode($pair[0])] = urldecode($pair[1]);
         }
       return $result;
      }
  </code></pre>
  
  <p>now i'm getting</p>
  
  <pre><code>    explode = {
          " \"sessionId\" " = " \"132156\",";
          " \"sessionName\" " = " \"My Name\"";
          "{" = "";
          "}" = "";
      };
  </code></pre>
  
  <p>How can I 'clean' the array any further so my arry will be like </p>
  
  <pre><code>        "sessionId" = "132156";
          "sessionName" = "My Name";
  </code></pre>
  
  <p>Thanks</p>