This command can be used to get the cost of a send without sending the message. You need to follow these steps to get the cost of a send
<?php // Account details $apiKey = urlencode('Your apiKey'); // Message details $numbers = array(447123456789,447987654321); $sender = urlencode('Jims Autos'); $message = urlencode('This is your message'); $numbers = implode(',', $numbers); // Prepare data for POST request $data = array('apikey' => $apiKey, 'numbers' => $numbers, "sender" => $sender, "message" => $message, "test" => '1'); // Send the POST request with cURL $ch = curl_init('https://api.txtlocal.com/send/'); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); // Process your response here $responseArray = json_decode($response, true); $cost = $responseArray['cost']; echo $cost; ?>
<?php // Account details $apiKey = urlencode('Your apiKey'); // Message details $numbers = urlencode('447123456789,447987654321'); $sender = urlencode('Jims Autos'); $message = urlencode('This is your message'); // Prepare data for POST request $data = 'apikey=' . $apiKey . '&numbers=' . $numbers . "&sender=" . $sender . "&message=" . $message . "&test=1"; // Send the GET request with cURL $ch = curl_init('https://api.txtlocal.com/send/?' . $data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); // Process your response here $responseArray = json_decode($response, true); $cost = $responseArray['cost']; echo $cost; ?>