SMS

$from, ‘To’ => $to, ‘Body’ => $message, ); $response = wp_remote_post($url, array( ‘body’ => $body, ‘headers’ => array( ‘Authorization’ => ‘Basic ‘ . base64_encode(“$sid:$token”) ), )); if (is_wp_error($response)) { return ‘Error sending SMS: ‘ . $response->get_error_message(); } else { return ‘SMS sent successfully!’; } } // Test Example: add_action(‘init’, function() { if (isset($_GET[‘test_twilio_sms’])) { echo send_twilio_sms(‘+919876543210’, ‘Hello! Test SMS from WordPress.’); exit; } });
Scroll to Top