Is it possible to form http requests without using curl, sockets, etc., and, for example, using js?

Started to familiarize himself with API SMS gateway smsc.ru.
3b5d298ab6bb44e9806e57cb5dc2e15b.PNG

How can I create this request using cURL? Maybe you can do it with js? Because when I told the person who gave the assignment what are you trying to connect cURL - he said that this is not necessary, and you just need using js to get data from my database and generate query. Don't quite understand how to do it.
July 8th 19 at 16:05
5 answers
July 8th 19 at 16:07
Solution
Person proposes to comply with a request from the browser and to Shine the password, even hashed? Take https://github.com/jhaoda/SMSCenter and do not suffer.
July 8th 19 at 16:09
Solution
php - file_get_contents, fopen - i.e. using stream wrappers.

js - on the client haven't heard of it, on the server most likely, but there is need Node.js
July 8th 19 at 16:11
Solution
AJAX to help you.
right. The transmitted data can be read so that it is not good
jQuery.ajax({
'url':'link_to_api',
'data':'string_or_object',
...
});
July 8th 19 at 16:13
Solution
sockets here at anything, it's for TCP/IP, and here HTTP, any HTTP requests can be sent from server using Node.js or PHP, the simplest file_get_contents in PHP, but if from the client side (JavaScript), then using jQuery or XMLHttpRequest directly ( xmlhttprequest.ru ), but to send requests from a browser requires that the server (smsc.ru) this is allowed (cross domain policy).
July 8th 19 at 16:15
Solution
var settings = {
 "async": true,
 "crossDomain": true,
 "url": "https://smsc.ru/sys/send.php?login=login&psw=pass&phones=phones&mes=message",
 "method": "GET",
 "headers": {
 "cache-control": "no-cache",
}
}

$.ajax(settings).done(function (response) {
console.log(response);
});

Find more questions by tags JavaScriptAPIPHP