Snippets

Team Zoom PHP - bulk send using json and curl

Created by Terence Foxcroft last modified Curtis Sahd
<?php

// note: the PHP cURL library must be installed to send using this method

$credentials = "YOUR_EMAIL_ADDRESS:YOUR-API-TOKEN";

$url = "https://www.zoomconnect.com/app/api/rest/v1/sms/send-bulk.json";

$message1 = new stdClass();
$message1->message = 'Test message 1';
$message1->recipientNumber = '27821234567';

$message2 = new stdClass();
$message2->message = 'Test message 2';
$message2->recipientNumber = '+27821234568';

$data = new stdClass();
$data->sendSmsRequests = array($message1, $message2);

$data_string = json_encode($data);

$ch = curl_init($url);                                                                      
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");                                                                     
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);                                                                  
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);                                                                      
curl_setopt($ch, CURLOPT_HTTPHEADER, array(                                                                          
    'Content-Type: application/json',     
    'Authorization: Basic ' . base64_encode($credentials),                                                                           
    'Content-Length: ' . strlen($data_string))                                                                       
);                                                                                                                   
 
$result = curl_exec($ch);
echo 'Reponse ' . $result;

?>

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.