| SOAP Protocol
<? // Отправка сообщения
$client = new SoapClient ("http://smscentre.com/sys/soap.php?wsdl"); $ret = $client->send_sms(array("login"=>"alex", "psw"=>"123", "phones"=>"79999999999", "mes"=>"Hello world!", "id"=>"", "sender"=>"ivan", "time"=>0));
if ($ret->sendresult->error) echo "Ошибка №".$ret->sendresult->error; else { echo $ret->sendresult->id, "\n"; echo $ret->sendresult->balance, "\n"; echo $ret->sendresult->cost, "\n"; echo $ret->sendresult->cnt, "\n"; }
//Flash сообщение от отправителя "ivan", которое должно быть доставлено абоненту 01.01.2012 г. в 00:00:
$ret = $client->send_sms2(array("login"=>"alex", "psw"=>"123", "phones"=>"79999999999", "mes"=>"Hello world!", "id"=>"", "sender"=>"ivan", "time"=>"0101120000", "query"=>"flash=1"));
if ($ret->sendresult->error) echo "Ошибка №".$ret->sendresult->error; else { echo $ret->sendresult->id, "\n"; echo $ret->sendresult->balance, "\n"; echo $ret->sendresult->cost, "\n"; echo $ret->sendresult->cnt, "\n"; }
//Несколько сообщений разным абонентам:
$ret = $client->send_sms2(array("login"=>"alex", "psw"=>"123", "phones"=>"", "mes"=>"", "id"=>"", "sender"=>"", "time"=>0, "query"=>"list=79999999999:message1%0A79999999998:message2"));
if ($ret->sendresult->error) echo "Ошибка №".$ret->sendresult->error; else { echo $ret->sendresult->id, "\n"; echo $ret->sendresult->balance, "\n"; echo $ret->sendresult->cost, "\n"; echo $ret->sendresult->cnt, "\n"; }
// Получение стоимости
$ret = $client->get_sms_cost(array("login"=>"alex", "psw"=>"123", "phones"=>"79999999999", "mes"=>"Hello world!"));
if ($ret->costresult->error) echo "Ошибка №".$ret->costresult->error; else { echo $ret->sendresult->cost, "\n"; echo $ret->sendresult->cnt, "\n"; }
// Проверка статуса
$ret = $client->get_status(array("login"=>"alex", "psw"=>"123", "phone"=>"79999999999", "id"=>"999", "all"=>"0")); echo "Ошибка №".$ret->statusresult->error; else { echo $ret->statusresult->status, "\n"; echo $ret->statusresult->last_date, "\n"; echo $ret->statusresult->err, "\n"; }
// Расширенный статус
$ret = $client->get_status(array("login"=>"alex", "psw"=>"123", "phone"=>"79999999999", "id"=>"999", "all"=>"2")); echo "Ошибка №".$ret->statusresult->error; else { echo $ret->statusresult->status, "\n"; echo $ret->statusresult->last_date, "\n"; echo $ret->statusresult->err, "\n"; echo $ret->statusresult->last_timestamp, "\n"; echo $ret->statusresult->send_date, "\n"; echo $ret->statusresult->send_timestamp, "\n"; echo $ret->statusresult->phone, "\n"; echo $ret->statusresult->cost, "\n"; echo $ret->statusresult->sender_id, "\n"; echo $ret->statusresult->status_name, "\n"; echo $ret->statusresult->message, "\n"; echo $ret->statusresult->operator, "\n"; echo $ret->statusresult->region, "\n"; }
// Проверка баланса
$ret = $client->get_status(array("login"=>"alex", "psw"=>"123"));
if ($ret->balanceresult->balance) echo "Ошибка №".$ret->sendresult->error; else echo $ret->balanceresult->balance, "\n";
?>
|