'How to integrate third party api in my site magento

I am using Magento ver. 1.9.2.1. I don't have any idea to integrate third party api in magento. I have to integrate the api for website.com, for that they provide the login details and a doc. In that doc, it is mentioned to integrate

1. Search Service Availability API
2. Order Creation API
3. Tracking API

For each above API, they provide code,details and json response. I have created a user and role from admin. And create a file test.php in root folder and put their code and checked in browser, but it shows blank

Given code in doc for Search Service Availability API:

<?php

ob_start();

error_reporting( 0 );

ini_set('display_errors', 'off');

$pickup_pincode = ‘110001’ // pass pincode

$delivery_pincode =’110001’; // Pass the Parameters Here pincode

$service=’Online’ // Cod or Online

$weight=’1’ // pass weight

$service_name = ‘Standard’ // standard / Priority / Economy

$request_url ='http://avnbiz.co.in/test/AVNBIZ/webservice/test_search_service.php';

$post_data =

'&pickup_pincode=$pickup_pincode&delivery_pincode=$delivery_pincode&weight=$w

eight&service=$service&service_name=$service_name'';

$post = curl_init();

curl_setopt($post, CURLOPT_URL, $request_url);

curl_setopt($post, CURLOPT_POST,TRUE);

curl_setopt($post, CURLOPT_POSTFIELDS, $post_data);

curl_setopt($post, CURLOPT_RETURNTRANSFER, TRUE);

$response = curl_exec($post);

curl_close($post);

print_r($response);

$result = json_decode($response, true);

print_r($result);

?>

response

[{"Service Name":"Standard","partner_id":"2","partner_name":"DOT 

ZOT","price":"0","status":"PRICE NOT AVAILABLE "},{"Service 

Name":"Standard","partner_id":"9","partner_name":"GATI","price":"0","status":"PRICE 

NOT AVAILABLE "},{"Service 

Name":"Standard","partner_id":"324","partner_name":"Fedex TSCI Pvt 

Ltd","price":"50","status":"Success"},{"Service 

Name":"Standard","partner_id":"327","partner_name":"GATIKWE EXPRESS PVT 

LTD","price":"50","status":"Success"},{"Service 

Name":"Standard","partner_id":"335","partner_name":"demo","status":"NO SERVICE 

AVAILABLE"}]

If anyone has any idea, please let me know where I am making a mistake.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source