0

I am creating a Courier tracking plugin and get data using their API. The output they are returned is in JSON format. Here is the courier API

$curl_handle = curl_init();
// For Direct Link Access use below commented link
//curl_setopt($curl_handle, CURLOPT_URL, 'http://new.leopardscod.com/webservice/trackBookedPacket/?api_key=XXXX&api_password=XXXX&track_numbers=XXXXXXXX');  // For Get Mother/Direct Link

curl_setopt($curl_handle, CURLOPT_URL, 'http://new.leopardscod.com/webservice/trackBookedPacket/format/json/');  // Write here Test or Production Link
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl_handle, CURLOPT_POST, 1);
curl_setopt($curl_handle, CURLOPT_POSTFIELDS, array(
    'api_key' => 'your_api_key'
    'api_password' => 'your_api_password'
    'track_numbers' => 'string'                      // E.g. 'XXYYYYYYYY' OR 'XXYYYYYYYY,XXYYYYYYYY,XXYYYYYY' 10 Digits each number
));

$buffer = curl_exec($curl_handle);
curl_close($curl_handle);

How to echo the values get from this curl command?

Regards

0

1 Answer 1

0

Please use json_decode function after $buffer = curl_exec($curl_handle);

$buffer = curl_exec($curl_handle);
$json = json_decode($buffer, true);
print_r($json);

You can get PHP object array

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.