$token = 'YOUR_API_TOKEN';
$baseUrl = 'https://tamonay.tr/api/v1';
// Kullanıcı bilgilerini al
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $baseUrl . '/user');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer ' . $token,
'Accept: application/json',
]);
$response = curl_exec($ch);
$userData = json_decode($response, true);
curl_close($ch);
// Sipariş oluştur
$orderData = [
'service_id' => 1,
'operator' => 'turkcell'
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $baseUrl . '/orders');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($orderData));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer ' . $token,
'Accept: application/json',
'Content-Type: application/json',
]);
$response = curl_exec($ch);
$orderResult = json_decode($response, true);
curl_close($ch);