Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
Your question is wrong.
You are asking about sending via php, but in fact you are looking for the least expensive way.
-
I made myself free from the word at all, even 600 sms and I don’t pay for them)
, however, I already had iron (homemade).
--- Needed
:
1. e3372 modem
2. Kinetic router with usb
3. Denik's SIM card, which gives 600 sms for 0 rubles for nothing, or a megaphone or Yota give a conditional unlimited SMS for 50 rubles. In fact, they block sending if you exceed the limit per hour.
4. White ip is not needed. Internet on the SIM card is also not needed
We flash the modem in hilink, turn on keendns on the router, add the modem to this service, when turned on, an address on the Internet and ssl will be issued, in the same place in the router we close the modem with a password.
Further, the modem can be accessed not only via the local network 192.168.8.1, but also from the Internet (thanks to the kinetics)
We
write php code, we need to write several functions (sending, receiving, deleting, receiving a token)
//функция Отправки СМС
function send($sms_phone, $sms_message){
$xml = auth();
$options = array(
CURLOPT_HTTPAUTH => CURLAUTH_BASIC,
CURLOPT_USERPWD => 'admin:[email protected]',
CURLOPT_URL => 'https://modem.ВАШЕ_ИМЯ.keenetic.link/api/sms/send-sms',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_USERAGENT => 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36',
CURLOPT_HTTPHEADER => array("X-Requested-With: XMLHttpRequest",'Cookie:'. $xml->SesInfo,'__RequestVerificationToken:'. $xml->TokInfo,'"Content-Type:application/x-www-form-urlencoded; charset=UTF-8"'),
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => "<request><Index>-1</Index><Phones><Phone>".$sms_phone."</Phone></Phones><Sca/><Content>".$sms_message."</Content><Length>5</Length><Reserved>1</Reserved><Date>".date("Y-m-d H:i:s")."</Date></request>"
);
$curl = curl_init();
curl_setopt_array($curl, $options);
curl_exec($curl);
curl_close($curl);
};
send($sms_phone, $sms_message);
To send SMS to +79040601199 from php , run the following code:
<?php
header('Content-Type: text/html; charset=utf-8');
$url = 'https://sms.ru/sms/send?api_id=0165484B-5891-4EA8-FD86-D4BB4A0A7CCA&to=79040601199&msg=Prvet+vsem&json=1';
echo file_get_contents($url);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question