1
我需要一些關於BigCommerce API的幫助。我想問,我怎麼能寫這個聲明獲取Bigcommerce中訂單的產品
GET orders/{id}/products.json
在PHP中。
基本上我試圖從特定的訂單中獲取產品。如果我在命令提示符下鍵入它,它將返回貨品中的產品,但我想在PHP中運行它。
任何想法?
讓我知道謝謝。
我需要一些關於BigCommerce API的幫助。我想問,我怎麼能寫這個聲明獲取Bigcommerce中訂單的產品
GET orders/{id}/products.json
在PHP中。
基本上我試圖從特定的訂單中獲取產品。如果我在命令提示符下鍵入它,它將返回貨品中的產品,但我想在PHP中運行它。
任何想法?
讓我知道謝謝。
您可以捲曲請求的Bigcommerce產品API
下面是一個簡單的捲曲段獲得產品的詳細信息:
<?php
$api_url = 'https://XYZ.mybigcommerce.com/api/v2/orders/201/products.json';
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, array ('Accept: application/json', 'Content-Length: 0'));
curl_setopt($ch, CURLOPT_URL, $api_url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_USERPWD, "admin:YOUR API KEY");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
$result = json_decode($response);
echo "<pre>";
print_r($result);
echo "</pre>";
?>