In this tutorial we will learn how we can get Bigcommerce customers data via php curl and Bigcommerce api. Also we will learn how we can create Api key and Token in Bigcommerce.
Example 1
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.bigcommerce.com/stores/d8duagpv34/v3/customers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Auth-Token: rz39hb9z473aktncwzqci49fjl80jw3"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
echo '<pre>';
if ($err) {
echo "cURL Error #:" . $err;
} else {
print_r(json_decode($response));
}
Example 2
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.bigcommerce.com/stores/d8duagpv34/v3/catalog/products",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Auth-Token: rz39hb9z473aktncwzqci49fjl80jw3"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
echo '<pre>';
if ($err) {
echo "cURL Error #:" . $err;
} else {
print_r(json_decode($response));
}
Api Documentation Url : https://developer.bigcommerce.com/api-reference/4101d472a814d-get-all-products
Thanks