Hello, I have written a PHP script which sends SMSes using FreeSMSAPI. But, I want to parse the JSON API response in PHP. I want some fields from JSON, like the mobile number, etc. By default, it shows the default message. I want to show my own message when message gets sent or fails. The API response in JSON comes like this: { "response":{ "success":{ "message":"Message Send Successfully", "number":["9699419699","9892098920"] } } } HTML: My script written in PHP: <?php $skey = "mysecretkey"; $tonumber = $_POST['recnumber']; $tomessage = $_POST['message']; $response = file_get_contents("http://s2.freesmsapi.com/messages/send?skey=$skey&message=".urlencode($tomessage)."&senderid=MyID&recipient=$tonumber&format=json"); $json_a = json_decode($response); if($json_a->status === "success") { echo $json_a->number; } else { echo 'Message not sent.'; } ?> HTML: When I use the above PHP code, it doesn't show anything. It shows only blank page.
Finally, you had better use print_r($json_a); thus you can see array. After, you write output to here.