M
M
m1rvi2020-09-13 18:30:38
PHP
m1rvi, 2020-09-13 18:30:38

How to send sms via php?

You need to register with SMS. I googled this question, found api, but as I understand it, it is
expensive

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Anton, 2020-09-13
@m1rvi

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);
};

And the sending itself:
send($sms_phone, $sms_message);
On the server, you need to check the number and spam protection:
Checking can be done here, including region restrictions:
rosreestr.subnets.ru/?get=num&num=79152000200
--
Thus, your site can send SMS.
You can send and receive SMS to / from Telegram. Do not pay anything if you do not act without limits, do not send
advertising and do not exceed the limits

N
Nadim Zakirov, 2020-09-14
@zkrvndm

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);

Where api_id is a unique key obtained from the personal account on the sms.ru website,
to is the recipient's number,
msg is the text of the message.

V
Vitaliy K, 2020-09-14
@revenger

Turbosms

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question