如何在我的站点magento中集成第三方api

时间:2016-01-12 07:09:26

标签: magento magento-1.9 magento-1.9.2.1

我正在使用Magento ver。 1.9.2.1。 我不知道将第三方api集成到magento中。我必须为website.com集成api,因为它们提供了登录详细信息和文档。 在该文档中,提到了集成

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

对于上述每个API,它们都提供代码,详细信息和json响应。 我已经从admin创建了一个用户和角色。并在根文件夹中创建一个文件test.php并将其代码放入浏览器中检查,但它显示为空白

给出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);

?>

响应

[{"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"}]

如果有任何人有任何想法,请让我知道我在哪里弄错了

由于

0 个答案:

没有答案