how to convert a json response to a text output.?

54 views Asked by At

I am using a platforme call ideamart to create some sms based applications. They provide a api called subscription api.

deatils about ideamart subscription API

Guid to work with subscription API

I use below first code to request BaseSize details.is that code is correct.? can I Display response using PHP echo() Function .? or any other way.?

  <?php 
 include_once "definitions.php";
 include_once "subscription.php";
 $sub = new Subscription();
 $AppId = "APP_00001";
 $Password = "yuhst345";
 $baseSize = $sub->getBaseSize($AppId,$Password);
 ?>

here is the getBaseSize function that includes in subscription.php

public function getBaseSize($applicationId, $password){
    $arrayField = array(
        "applicationId" => $applicationId,
        "password" => $password);

    $jsonObjectFields = json_encode($arrayField);
    $resp=$this->sendBaseRequest($jsonObjectFields);
    $response = json_decode($resp, true);

    $statusDetail = $response['statusDetail'];
    $statusCode = $response['statusCode'];
    $status =$response['baseSize'];

    return $status;

}
1

There are 1 answers

0
Adam J On BEST ANSWER

So, it looks like your getBaseSize() is returning an simply the base size. So, you should be able to do a

print $baseSize; OR echo $baseSize;

And you'll print out the string.