Snippets

Team Zoom PHP - send using xml and curl

Updated by Curtis Sahd

File php-send-using-xml-and-curl.php Modified

  • Ignore whitespace
  • Hide word diff
 
 $credentials = "YOUR_EMAIL_ADDRESS:YOUR-API-TOKEN";
 
-$url = "https://www.zoomconnect.com/zoom/api/rest/v1/sms/send.xml";
+$url = "https://www.zoomconnect.com/app/api/rest/v1/sms/send.xml";
 
 $xml = new SimpleXMLElement("<?xml version=\"1.0\" encoding=\"utf-8\" ?><sendSmsRequest></sendSmsRequest>");
 $xml->addChild('message', "Test message");
-$xml->addChild('recipientNumber', "27821234567");
+$xml->addChild('recipientNumber', "+27821234567");
                                                               
 $data_string = $xml->asXML();
  
Updated by Terence Foxcroft

File php-send-using-xml-and-curl.php Modified

  • Ignore whitespace
  • Hide word diff
 
 // note: the PHP cURL library must be installed to send using this method
 
-$credentials = "super@zoom.co.za:bd3ed45a-6def-473b-94ac-87bee6b4fd43";
+$credentials = "YOUR_EMAIL_ADDRESS:YOUR-API-TOKEN";
 
-$url = "http://localhost:8080/zoom/api/rest/v1/sms/send.xml";
+$url = "https://www.zoomconnect.com/zoom/api/rest/v1/sms/send.xml";
 
 $xml = new SimpleXMLElement("<?xml version=\"1.0\" encoding=\"utf-8\" ?><sendSmsRequest></sendSmsRequest>");
 $xml->addChild('message', "Test message");
Created by Terence Foxcroft

File php-send-using-xml-and-curl.php Added

  • Ignore whitespace
  • Hide word diff
+<?php
+
+// note: the PHP cURL library must be installed to send using this method
+
+$credentials = "super@zoom.co.za:bd3ed45a-6def-473b-94ac-87bee6b4fd43";
+
+$url = "http://localhost:8080/zoom/api/rest/v1/sms/send.xml";
+
+$xml = new SimpleXMLElement("<?xml version=\"1.0\" encoding=\"utf-8\" ?><sendSmsRequest></sendSmsRequest>");
+$xml->addChild('message', "Test message");
+$xml->addChild('recipientNumber', "27821234567");
+                                                              
+$data_string = $xml->asXML();
+ 
+$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/xml',     
+    'Authorization: Basic ' . base64_encode($credentials),                                                                           
+    'Content-Length: ' . strlen($data_string))                                                                       
+);                                                                                                                   
+ 
+$result = curl_exec($ch);
+echo 'Reponse ' . $result;
+
+?>
HTTPS SSH

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