Snippets

Team Zoom PHP - send using json and curl

You are viewing an old version of this snippet. View the current version.
Revised by Terence Foxcroft 4fd957b
<?php

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

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

$data = new stdClass();
$data->message = 'Test message';
$data->recipientNumber = '27821234567';
                                                              
$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 $result;

?>
HTTPS SSH

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