<?php

ini_set("display_errors", "on");

$mobile = '01115271925';

// send to Egypt only
$recipient = ltrim($mobile, "2");
$recipient = ltrim($recipient, "+2");
$recipient = ltrim($recipient, "02");
$recipient = ltrim($recipient, "002");
$recipient = ltrim($recipient, "0");
$recipientWithCode = "20" . ($recipient);
$message = 'نسعد بتقديم أفضل الخدمات لعملائنا الكرام';
$query = [
    'environment' => 1, //1 For Live , 2 For Test,
    'username' => 'oUc7NXwC',
    'password' => '36e1da61469532f112a3adce9711c01d02514a5f0e757a31008f944903102113',
    'language' => 2, //1 For English , 2 For Arabic , 3 For Unicode
    'sender' => 'c9574236504eb5120e0bda1baeb8911675ea3c722b10f8e31095eb4846fdc15f',
    'mobile' => $recipientWithCode,
    'message' => $message
];
$buildQuery = http_build_query($query);
$requestUrl = "https://smsmisr.com/api/SMS/?" . $buildQuery;

$curl = curl_init();
print_r($curl);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt_array($curl, array(
    CURLOPT_URL => $requestUrl,
    CURLOPT_HEADER => false,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => '',
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_HTTPHEADER => array('Content-Type:application/json', 'Content-Length:0')
));
$response = curl_exec($curl);
print_r($response);
curl_close($curl);
echo $response;

