A
A
amikolyk2015-01-20 19:54:21
PHP
amikolyk, 2015-01-20 19:54:21

How to send an event from a site to a vps server?

The website is hosted. A button with the parameter
How to send and process a click event on the vps server (windows) was pressed on the site.
Server 1 (Apache php, mysql) - it hosts a website.
Server 2 (windows) - there is some program.exe on it
The event occurs on server 1 (clicking a button on the site)
And event processing on Server 2 program.exe
how to tell C2 that an event has occurred on C1

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
samizdam, 2015-01-20
@samizdam

>9000 ways.
google for "client-server".
in your case
1. Button - client, Apache + php - server. Here is Ajax or native browser controls for sending a request to the server.
2. Server 1 - php client, Server 2 - server. A php client can almost hit your Windows server using any protocol, there are >9000 options. Choose the easier it is to process the request on the Windows side to pull the boring executable.
PS or, if not a client-server architecture, then you can look in the direction of subscriptions and events:
1. there is a bus (maybe in the form of a third server even =) a message queue, for example) available to both servers.
2. php after clicking the button puts an event there
3. under Windows, someone listens to the event and pulls the executable when it occurs.
Again, the implementation will most likely depend on what is easier to use on the Windows side. And again, 100,500 options can be thought of.

M
m0rd, 2015-01-21
@m0rd

program.exe listens on a port, a PHP script breaks on this port via a socket and transfers information

P
Pavel Zhukau, 2015-01-20
@NikesDark

We send:

<?php
  if( $curl = curl_init() ) {
    curl_setopt($curl, CURLOPT_URL, 'http://mysite.ru/receiver.php?a=5&b=10');
    curl_setopt($curl, CURLOPT_RETURNTRANSFER,true);
    $out = curl_exec($curl);
    echo $out;
    curl_close($curl);
  }
?>

Get:receiver.php
<?php
  $a = $_GET['a'];
  $b = $_GET['b'];
  echo $a + $b;
?>

Learn to use Google.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question