herkese merhabalar panelimdeki ürünü yazdırmak istiyorum fakat pazaryerindeki api adresim hata veriyor id ve key doğru olmasına rağmen API hatası veriyor pazaryerine talep açtım ama API adresiyle ilgili herhangi bir sorun olmadığını söyledi acaba apı url adresımı hatalı
<?php
// Çiçek Sepeti API URL'si
$url = 'https://seller-web.ciceksepeti.com/order/api/v1/orderitems';
// Sipariş ID'si ve API anahtarı
$order_id = '';
$api_key = ''; // Add your correct API key here
// API isteği oluşturma
$options = array(
'http' => array(
'header' => "Authorization: Bearer $api_key\r\n",
'method' => 'GET'
)
);
$context = stream_context_create($options);
$response = file_get_contents("$url/$order_id", false, $context);
// Yanıtı işleme
if ($response === FALSE) {
echo "API isteği başarısız oldu";
} else {
$order_info = json_decode($response, true);
// Sipariş bilgilerini listele
if (isset($order_info['data'])) {
foreach ($order_info['data'] as $order) {
echo "Sipariş ID: " . $order['OrderId'] . "<br>";
echo "Müşteri Adı: " . $order['BuyerName'] . "<br>";
echo "Sipariş Durumu: " . $order['OrderStatus'] . "<br>";
echo "Toplam Tutar: " . $order['TotalPrice'] . "<br><br>";
}
} else {
echo "Sipariş bilgileri bulunamadı.";
}
}
?>
en son aldığım hata
Authorization Error: Unauthorized. Please check your API key.