Answer the question
In order to leave comments, you need to log in
How to restart OpenServer remotely with a regular GET request?
I have almost ready solution, but there was a slight difficulty.
I know that OpenServer has a web muzzle:
To restart it is enough to follow a link of this type:
localhost:1515/restart
To confirm the rights, Basic Authentication authorization is used there.
Accordingly, nothing prevents me from simply remotely making a GET request to my server with the necessary headers:
jQuery.ajax({
url: 'http://123.123.123.123:1515/restart',
headers: {
'Authorization': 'Basic ' + btoa('admin:admin')
},
success: function(response){
console.log(response);
},
error: function(obj) {
alert('Ошибка!');
}
});
'Access-Control-Allow-Origin: *');
header(
Answer the question
In order to leave comments, you need to log in
Damn, I should have read how Basic Auth works first. The solution turned out to be surprisingly simple, if I want to remotely restart the server, then I can initiate the desired request NOT from my native domain like this:
open_server_restart_window = window.open('');
open_server_restart_window.location.href = 'http://login:[email protected]:1515/restart';
setTimeout(function() { open_server_restart_window.close(); }, 3000);
If there is PHP on the same server, then what prevents a script from being written that will pull the desired internal URL with curl?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question