I've done this many times before with various SAAS services, but I can't parse the supposedly JSON responses I'm getting from Blitline image processing's API.
Here's what I do to handle the POST:
$body=@file_get_contents('php://input');
print_r($body);
results=%7B%22original_meta%22%3A%7B%22width
OR
$body=rawurldecode($body);
print_r($body);
results={"original_meta":{"width ...
When I go to print $body->original_meta->width, I get an empty string. You'll realize I didn't json_decode() the $body but that's because that returns an empty string too.
Removing the results= with substr($body, 8) doesn't help either.
Can anyone help?
resultswith a URL-encoded JSON string value. Perhaps in this case you should actually be getting your value from$_POST(that is of course if request is coming in with form-encoded content type header.$data = json_decode($_POST['results']).$_POSTinstead of reading input.