هر گونه سوال یا ابهامی را با تیم فنی ما در میان بگذارید.
<?php $data = array( 'from' => '3000XXXX', 'to' => ['09XXXXXXXXX', '09XXXXXXXXX'], 'text' => 'Salam' ); $payload = json_encode($data); $curl = curl_init(); //curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt_array($curl, array( CURLOPT_URL => "https://api.sapak.me/v1/messages", CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => $payload, CURLOPT_HTTPHEADER => array("Content-Type:application/json", "X-API-KEY: YOUR API KEY") )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } ?>
using (var client = new HttpClient()) { var data = new { from = "3000XXXXXX", to = new string[] { "0912XXXXXXX", "0911XXXXXXX" }, text = "Test", }; string url = "https://api.sapak.me/v1/messages"; client.DefaultRequestHeaders.Add("X-API-KEY", "YOUR API KEY"); var content = new StringContent(JsonConvert.SerializeObject(data), Encoding.UTF8, "application/json"); var httpResponse = client.PostAsync(url, content).GetAwaiter().GetResult(); string responseJson = httpResponse.Content.ReadAsStringAsync().GetAwaiter().GetResult(); if (httpResponse.IsSuccessStatusCode) { var results = JsonConvert.DeserializeObject<IEnumerable<dynamic>>(responseJson); foreach (var entry in results) { long smsId = entry.id; int status = entry.status; } } else { var errorObject = JsonConvert.DeserializeObject<dynamic>(responseJson); string errorMessage = errorObject.message; } }
import requests url = "https://api.sapak.me/v1/messages" payload = "text=Salam&from=3000XXXX&to=09XXXXXXXXX" headers = {'X-API-KEY': "YOUR API KEY"} response = requests.request("POST", url, data=payload, headers=headers) print(response.text)
<?php $username='XXXXXXXX'; $password='XXXXXX'; $sendNumber='XXXXXXXXXX'; $message='test'; $mobiles=array(); array_push($mobiles,'09XXXXXXXXX'); $client=new SoapClient("https://api.sapak.me/soap/smsService.svc?singlewsdl"); $params=array('username'=>$username,'password'=>$password, 'senderNumber'=>$sendNumber,'recipientNumbers'=>$mobiles,'message'=>$message,'saveType'=>1); $result=$client->sendMessage($params); ?>
SmsServiceClient smsService = new SmsServiceClient(); string[] result = smsService.SendMessage( "USERNAME", "PASS", "3000XXXX", new string[] {"09XXXXXXXXX", "09XXXXXXXXX"}, "TEST", 1);
import zeep username = 'username' password = 'password' sendNumber = 'senderNumber' message = "test" mobiles = ["09XXXXXXXXX", "09XXXXXXXXX"] params = {'username': username, 'password': password, 'senderNumber': sendNumber, 'recipientNumbers': mobiles,'message': message, 'saveType': 1} url = "https://api.sapak.me/soap/smsService.svc?singlewsdl" client = zeep.Client(wsdl=url) client.service.SendMessage(**params)