-
Notifications
You must be signed in to change notification settings - Fork 0
/
sms.to-example-code-php.txt
42 lines (30 loc) · 1.03 KB
/
sms.to-example-code-php.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
Service: https://sms.to
https://developers.sms.to/
*use PHP-cURL as LANGUAGE
*use microsoft co pilot for help
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class SmsController extends CI_Controller {
public function __construct() {
parent::__construct();
}
public function send_bulk_sms() {
$api_key = 'YOUR_SMS_TO_API_KEY';
$url = 'https://api.sms.to/sms/send';
$recipients = ['+1234567890', '+0987654321']; // Add your recipients here
$message = 'Your bulk SMS message here';
$data = [
'to' => implode(',', $recipients),
'message' => $message,
'sender_id' => 'YourSenderID',
'api_key' => $api_key
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
$response = curl_exec($ch);
curl_close($ch);
echo $response;
}
}