Aquí hay un breve consejo sobre cómo enviar automáticamente un formulario HTML usando una línea de comandos de Linux y un script Perl. Para este ejemplo, necesitaríamos un módulo www :: mecanice perl y algún sitio web de PHP básico. Comencemos con el sitio web de PHP simple. El sitio web consistirá en dos archivos:
forma.PHP:
Nombre Apellido:
entregar.php
Nombre de pila:
Apellido:
Cargue esos dos archivos al directorio de su servidor web y cambie sus permisos:
Formulario Chmod 755.PHP Enviar.php
Si aún no lo ha hecho, instale www :: mecanizar. En Debian o Ubuntu sería algo como esto:
# apt-get install libwww-mecanize-perl
y crea un script llamado mecanizar.por favor Con un contenido siguiente:
#!/usr/bin/perl use www :: mecanize; my $ mech = www :: mecanize-> new (); $ url = 'http: // localhost/form.php '; $ mech-> get ($ url); $ Mech-> Subt_Form (form_number => 1, Fields => fname => 'www', lname => 'mecanize',); imprimir $ mech-> content ();
Tenga en cuenta la URL en el script anterior. Edite esta URL para que se ajuste a su configuración. Hacer que el script sea ejecutable:
$ chmod +x mecanizar.por favor
Ahora ejecute este script y redirige toda la salida al índice.html
./mecanizar.pl> índice.html
Si todo estuviera bien, abrir el índice.html usando su navegador y debería ver:
Nombre: www
Apellido: mecanizar