arkadaşlar özelden soranlar için yazıyorum
public static function getSend($url, $post = 'GET', $data = NULL)
{
$apiKey = 'XXXX';
$apiPass = 'YYYY';
$merchand = '000';

$curl = curl_init($url);

curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
if ($post == 'POST')
curl_setopt($curl, CURLOPT_POST, true);
else
curl_setopt($curl, CURLOPT_POST, 0);

if ($data)
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);

$header = array(
'Authorization: Basic '. base64_encode($merchand.':'.$apiPass),
'Content-Type: application/json',
'User-Agent' => $apiKey,
);

curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
curl_setopt($curl, CURLOPT_USERAGENT, $apiKey);

$curl_response = curl_exec($curl);

if ($curl_response === false) {
$error = curl_error($curl);
curl_close($curl);
throw new Exception('Curl error: ' . $error);
}

curl_close($curl);

$sonuc = json_decode($curl_response, true);
return $curl_response;
}
Kullanım

public static function stokGuncelle($merchantSku, $adet)
{
global $merchand;
$url = "https://listing-external.hepsiburada.com/listings/merchantid/{$merchand}/stock-uploads";

$data = '[
{
"hepsiburadaSku": "'.$merchantSku.'",
"availableStock": '.$adet.'
}
]';
return self::getSend($url, 'POST', $data);
}
stokGuncelle('STOKKODUNUZ', 5) ; // Stok kodu hepsiburadada kayıtlı ürün kodudur