M
M
margaret_murka2021-10-13 09:49:34
PHP
margaret_murka, 2021-10-13 09:49:34

How to send SMS without submitting a form?

I apologize for the stupid question
. In general, I try to use the smsc.ru
service. It sends messages to phones (in short), in order to use it, you need to transfer some data using the POST or GET method, and it seems to return a line with data (a confirmation code, for example)
Well , the question is how to get this data on the page, in fact ...
I'm stupid and just through action = " https://smsc.ru/sys " I can send, but it goes to that page, it displays the data that I need , but I don’t know how to get it, I know
a little about ajax , but I didn’t understand how to call this https://smsc.ru/sys
from it I also tried with curlfigure it out, probably there and need to dig?
They also have something like a library in one file that is easy to use for
example:

list($sms_id, $sms_cnt, $cost, $balance) = send_sms("79999999999", "", 0, 0, 0, 3, false);

and in the $sms_id variables... in theory it should be what I need, if I understand correctly, but no, it
just sends
tell me what you can read, I'm already lost

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey delphinpro, 2021-10-13
@margaret_murka

They themselves said that there is a library.
Use it https://smsc.ru/api/code/libraries/http_smtp/php/#menu
_

T
ThunderCat, 2021-10-13
@ThunderCat

I also tried to figure it out with curl, probably I need to dig there?
yes, that's where it's needed. See examples of working with curls, there are many of them, easy to google. You can stupidly connect their library, as Sergey delphinpro advises , which immediately gives ready-made functions for all basic actions from the api service.
In general, requests to api are 90% performed in the server-server format, extremely rarely client-side server ...
In your case, it should be something like: you request data from your server with Ajax, your server creates a request to the service api, receives data and returns in the ajax response. All keys / logins / passwords are transmitted only from server to server, such information should not be lit at the front in any way .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question