Parsing result from file_get_contents('php://input')

You can use parse_str function to parse query string:

$queryString = 'inReplyToId=MG1133&to=61477751386&body=test&from=61477751386&messageId=166594397&rateCode=';
$data = array();
parse_str($queryString, $data);
var_dump($data);

Edit:

For example I would like to end up with:

$inReplyToId = MG1133
$to = 61477751386
$body = test

To get array keys as variable you can use extract:

extract($data);

Edit 2: If you already have code that uses $_POST variable with respective indexes you can merge data with it:

$_POST = array_merge($data, $_POST);

But modifing these variables is not advisable.

Tags:

Php

Arrays