Answer the question
In order to leave comments, you need to log in
What is the principle of sending an order form to the phone in SMS?
What is the principle of sending an order form to the phone in SMS? What is used, how is the usual js type different
$.ajax({
url: 'contacts.php',
type: 'post',
data: str
}).done(function(msg){
if(msg === "OK"){
console.log('ok');
}else {
...
}
}).always(function(){
...
});
Answer the question
In order to leave comments, you need to log in
only php file
smsc.ru changes - sending service
<?php
$name = @ trim ($_POST['name']);
$tel = @ trim ($_POST['tel']);
function send_sms($number, $text, $cost=0) {
$login = 'aaaaa'; // Логин в SMSC
$password = 'aaaaaa'; // Пароль в SMSC
$sender = 'aaaa'; // Имя отправителя
// Подготовим запрос
$Prepare = "http://smsc.ru/sys/send.php?login={$login}&psw={$password}&phones={$number}&mes={$text}";
$Request = file_get_contents($Prepare . "&cost={$cost}&fmt=1&charset=utf-8&sender={$sender}");
// Обработка ответа
$Response = explode(',', $Request);
if(isset($Response[1]) && isset($Response[0])) {
// Узнать цену
if($cost) {return $Response[0]; }
// SMS удачно дошло
if($Response[1] == '1') { return True; }
}
return False;
}
// Отправляем сообщение
$send = send_sms(+79999999999, "Новая заявка: $name $tel");
if($send == True) {
header('Location:index.html#senks');
}
?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question