Get a Free WhatsApp Business Account – Includes Onboarding, API Access & Sandbox. Apply Now!


Sample Code For Sending SMS in PHP

Sending SMS using Authkey APIs is a breeze and lightning fast. You can simply pass the message body, message sender, mobile number & authkey in the API request to send sms instantly.

Php Sample Code For Send SMS



 
 <?php

 $authkeyUrl = "https://api.authkey.io/request?";
 $paramArray = Array(
     'authkey' => 'AUKHKEY',
     'mobile' => 'RecepientMobile',
     'country_code' => 'CountryCode',
     'sms' => 'Hello this is a test message',
     'sender' => 'SENDERID'
     );
 
 $parameters = http_build_query($paramArray);
 $url = $authkeyUrl . $parameters;
 
 $curl = curl_init();
 
 curl_setopt_array($curl, array(
     CURLOPT_URL => $url,
     CURLOPT_RETURNTRANSFER => true,
 ));
 
 $response = curl_exec($curl);
 $err = curl_error($curl);
 
 curl_close($curl);
 
 if ($err) {
     echo "cURL Error #:" . $err;
 } else {
     echo $response;
 }
 
 ?>

Sending SMS using Authkey APIs is a breeze and lightning fast. You can simply pass the message body, message sender, mobile number & authkey in the API request to send sms instantly.