I have a Server 1 which will post JSON data to my Server 2 URL (Drupal Site)
Sample JSON Request Object
{"ConfirmationNumber":"344", "E-mailAddress":"[email protected]", "FirstName":"FIRSTNAME", "LastName":"LASTNAME", "SKU":"XYZ"}
I need to read the above request in Drupal site means Server 2 to parse the JSON Object and to do some business logic. Any quick help is really appreciated
Example: http://mydrupalsite.com/services/register
Some external site is posting the JSON data to my above URL.
I need to read the JSON Content they posted in my drupal site. This is what I want. Getting/Reading the data is the my first step. Parsing is fine which we can do as next step.
To read json response.
$url = "your request url";
$request = drupal_http_request($url);
$json_response = drupal_json_decode($request->data);
foreach ($json_response as $response_data) {
//your operation code
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With