import requests
import base64
app_id = “x”
app_sec = “y”
app_hash = base64.b64encode((app_id + ‘:’ + app_sec).encode()).decode()
messages = {
“messages”: [{
“text”: “test python”,
“numbers”: [“966xxxx”],
“sender”: “test”
}]
}
url = ‘https://api-sms.4jawaly.com/api/v1/account/area/sms/send’
headers = {
‘Accept’: ‘application/json’,
‘Content-Type’: ‘application/json’,
‘Authorization’: ‘Basic ‘ + app_hash
}
response = requests.post(url, headers=headers, json=messages)
print(response.json())
<?php
$curl = curl_init();
$app_id = “x”;
$app_sec = “y”;
$app_hash = base64_encode(“$app_id:$app_sec”);
$messages = [];
$messages[“messages”] = [];
$messages[“messages”][0][“text”] = “test php”;
$messages[“messages”][0][“numbers”][] = “966xxxx”;
$messages[“messages”][0][“sender”] = “test”;
curl_setopt_array($curl, array(
CURLOPT_URL => ‘https://api-sms.4jawaly.com/api/v1/account/area/sms/send’,
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_POSTFIELDS =>json_encode($messages),
CURLOPT_HTTPHEADER => array(
‘Accept: application/json’,
‘Content-Type: application/json’,
‘Authorization: Basic ‘.$app_hash
),
));
$response = curl_exec($curl);
curl_close($curl);
var_dump(json_decode($response));
Dart
task.resume()import ‘dart:convert’;
import ‘package:http/http.dart’ as http;
void main() async {
final appId = ‘x’;
final appSec = ‘y’;
final appHash = base64.encode(utf8.encode(‘$appId:$appSec’));
final messages = {
‘messages’: [
{
‘text’: ‘test dart’,
‘numbers’: [‘966xxxx’],
‘sender’: ‘test’
}
]
};
final url = Uri.parse(‘https://api-sms.4jawaly.com/api/v1/account/area/sms/send’);
final response = await http.post(
url,
headers: {
‘Accept’: ‘application/json’,
‘Content-Type’: ‘application/json’,
‘Authorization’: ‘Basic $appHash’,
},
body: json.encode(messages),
);
if (response.statusCode == 200) {
print(json.decode(response.body));
} else {
print(‘Error: ${response.statusCode}’);
}
}
$curl = curl_init();
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => “https://www.4jawaly.net/api/sendsms.php?username=user&password=pass&message=test%20sms%20from%20sameh&numbers=9665xxxxxxxx&sender=servarena&unicode=e&return=full”,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => “”,
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => “GET”,
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo “cURL Error #:” . $err;
} else {
echo $response;
}