Hagamos que México crezca..

Prefiere el consumo de lo Hecho en México

Prefiere el consumo de lo Hecho en México
BúsquedaHagamos que México crezca..
![]() Prefiere el consumo de lo Hecho en México Posts Recientes
Conversación |
How to use pipes with PHPPreviously I made a post about as execute externals pipe commands from an application using C language programming, now I was testing with PHP to execute pipes from a web page, this because many times I want run a linux script from a web page, but with < exec > function I cant run pipes commands, therefore I made the following script that let run pipe scripts commands from a web page with PHP:
<?php error_reporting(E_ALL); $echo_pipe = popen("echo \"Hello World\"", 'r'); echo "'$echo_pipe'; " . gettype($echo_pipe) . "\n"; $festival_pipe = popen("festival --tts", 'w'); echo "'$festival_pipe'; " . gettype($festival_pipe) . "\n"; if ((!$echo_pipe) || (!$festival_pipe)) { fprintf(stderr, "One or both pipes failed.\n"); return EXIT_FAILURE; } $bytes_read = 0; while ($buffer = fread($echo_pipe, 2096)) { fwrite($festival_pipe, $buffer); $bytes_read += strlen($buffer); } printf("Total bytes read = %d\n", $bytes_read); if (pclose($echo_pipe) != 0) { fprintf(stderr, "Could not run 'echo', or other error.\n"); } if (pclose($festival_pipe) != 0) { fprintf(stderr, "Could not run 'festival', or other error.\n"); } ?> Using pipes in PHP you can make interesting things, for example to send SMS using Gnokii among other things..
Fuentes XML de comentario: RSS | Atom
Estadísticas de visitantes185507 |
Nube de EtiquetasEventosEncuestaComentarios Recientes
|
Dejar un comentario