-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest_sms.php
More file actions
46 lines (40 loc) · 1.2 KB
/
test_sms.php
File metadata and controls
46 lines (40 loc) · 1.2 KB
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
42
43
44
45
46
<?php
require_once 'config.php';
require_once 'send_sms.php';
// Test message
$numbers = ['8544758216']; // Make sure this is the correct number
$message = "Test message from Fast2SMS";
$fields = array(
"message" => $message,
"language" => "english",
"route" => "v3", // Changed to v3 route for better delivery
"numbers" => implode(',', $numbers),
);
$ch = curl_init();
curl_setopt_array($ch, array(
CURLOPT_URL => "https://www.fast2sms.com/dev/bulkV2",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode($fields),
CURLOPT_HTTPHEADER => array(
"authorization: " . FAST2SMS_API_KEY,
"accept: */*",
"cache-control: no-cache",
"content-type: application/json"
),
));
$response = curl_exec($ch);
$err = curl_error($ch);
$info = curl_getinfo($ch);
echo "<h3>Debug Information:</h3>";
echo "<pre>";
echo "cURL Error: " . ($err ? $err : "None") . "\n";
echo "HTTP Code: " . $info['http_code'] . "\n";
echo "Response: " . $response . "\n";
echo "</pre>";
curl_close($ch);
?>