add_action('wpcf7_mail_sent', 'send_sms_after_form');function send_sms_after_form($contact_form) {// Get form submission
$submission = WPCF7_Submission::get_instance();
if (!$submission) return;$data = $submission->get_posted_data();// Get form fields (must match CF7)
$phone = isset($data['your-phone']) ? trim($data['your-phone']) : '';
$name = isset($data['your-name']) ? sanitize_text_field($data['your-name']) : 'Customer';// Stop if no phone
if (empty($phone)) return;// Convert 019XXXXXXXX → 88019XXXXXXXX
$phone = preg_replace('/^0/', '880', $phone);// API URL
$url = "https://isms.gennet.com.bd/api/v3/send-sms";// SMS Data
$sms_data = [
"api_token" => "PASTE_YOUR_NEW_API_TOKEN_HERE",
"sid" => "ShojonSheba",
"msisdn" => $phone,
"sms" => "Hello $name, আপনার রিকোয়েস্ট আমরা পেয়েছি। ধন্যবাদ!",
"csms_id" => uniqid()
];// Request args
$args = [
'body' => json_encode($sms_data),
'headers' => [
'Content-Type' => 'application/json'
],
'timeout' => 20
];// Send SMS
$response = wp_remote_post($url, $args);// Debug log
if (is_wp_error($response)) {
error_log('SMS Error: ' . $response->get_error_message());
} else {
$body = wp_remote_retrieve_body($response);
error_log('SMS Response: ' . $body);
}
}
Specification:
Brand: BMC
Type: BIPAP/ CPAP
৳ 13,000৳ 16,000