<?php
// Initialize cURL session
$curl = curl_init();

// Set cURL options
curl_setopt_array($curl, [
    CURLOPT_URL => "https://api.exotel.com/v1/Accounts/sahavastechnologies1/Calls/connect.json",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_POSTFIELDS => [
        'From' => "09224328435",
        'To' => "7021122990",
        'CallerId' => "022-461-80368"
    ],
    CURLOPT_HTTPHEADER => [
        "Authorization: Basic ZGY5NTgwMWRlY2Y2MzRjODNmNmZjOWUyNTRmOWRmOWNlOWZkMDY3NWQ1Nzg1MGRlOjc2Y2RhZjI2MmFjZDk3ZDFjNGJhNTVjODc1YzU4YWE4OGE5OTgxNGNkZGUzN2ZiNw==",
        "accept: application/json"
    ],
]);

// Execute cURL request and get the response
$response = curl_exec($curl);
$err = curl_error($curl);

// Close cURL session
curl_close($curl);

// Check for errors
if ($err) {
    echo "cURL Error #:" . $err;
} else {
    echo $response;
}
?>
