Receive real-time count of a program [closed]

-2

Is it possible to do an .exe program, which has a 60 second timer, and every second that passes would send information to a php page and that php page showed the real-time change of seconds depending on the program? >

If possible, how could you do this?

Thank you.

    
asked by anonymous 15.04.2016 / 22:26

1 answer

1

It is possible.

The following C # code can be compiled into a .exe file, and it does: Forever (1), wait sixty seconds (2), make a request on a PHP page (3) and pick up what the page prints for to process (4).

    public static void Main( string[] args )
    {
        int dados = 0;
        while ( true ) // 1
        {
            System.Threading.Thread.Sleep( TimeSpan.FromSeconds( 60 ) ); // 2
            dados++;
            using ( var client = new System.Net.WebClient() )
            {
                var retorno = client.DownloadString( "http://servidor.url/pagina.php?dado=" + dados ); // 3
                Console.WriteLine( retorno ); // 4
            }
        }
    }

You need to download an IDE from C # programming or the equivalent in another language.

You can also an .exe from a PHP , but it is not such a common solution.

    
15.04.2016 / 22:48