Version complète: sur le forum Webmaster Hub : Résultat d'une commande en html ou php
Webmaster Hub > Création et exploitation de Sites Internet > Les langages du Net > Scripts et utilitaires
dexmon
Salut,
voilà je cherche le moyen de, via un script .cgi ou .pl d'afficher le résultat de cette commande unix sur le serveur web :
CODE
pure-ftpwho -w >/usr/local/httpd/htdocs/traffic_ftp.html


Voici le résultat sur le shell:

CODE
linux~#:pure-ftpwho -w
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=ISO-8859-15" />
<title>Pure-FTPd server status</title>
<style type="text/css">
html {
background-color: #369;
}
body {
background-color: #fff;
color: #000;
margin: 12px;
padding: 8px;
border: 2px solid #000;
font-family: "Trebuchet MS",Verdana,Geneva,Arial,Helvetica,sans-serif;
font-size: 0.8em;
}
h1 {
text-align: center;
border-bottom: 1px solid #666;
margin: 0.5em 1em;
}
#ftp-status {
text-align: center;
}
table {
margin: 0 auto;
}
thead th {
background-color: #369;
color: #fff;
}
th,td {
padding: 0.1em 0.5em;
}
tr:hover {
background-color: #def;
}
</style>
</head>
<body>
<h1>Pure-FTPd server status</h1>
<div id="ftp-status">
<table summary="Pure-FTPd server status">
<thead>
<tr>
<th scope="col">PID</th>
<th scope="col">Account</th>
<th scope="col">Time</th>
<th scope="col">State</th>
<th scope="col" abbr="File">File name</th>
<th scope="col" abbr="Peer">Remote host</th>
<th scope="col" abbr="Kb">Kbytes</th>
<th scope="col" abbr="Local">Local host</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">18365</th>
<td>glinux</td>
<td>00:01</td>
<td>IDLE</td>
<td>&nbsp;</td>
<td>localhost.localdomain</td>
<td>&nbsp;</td>
<td>localhost.localdomain:21</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>


Et voici le résultat sur le navigateur:



Comment faire ?

Car je dois chaque fois tapper la commande sur le shell et ensuite me dirigez vers la page pour afficher le résultat et j'aimerais que ça se fasse automatiquement dés que je vais sur http://localhost/traffic_ftp.html
Jeromnimo
Si tu as accès à la fonction exec() en php, il te suffit de l'appeler et d'afficher son contenu, ce sera fait automatiquement à chaque chargement de la page ;-)
Ceci est une version "bas débit" de notre forum. Pour voir la version complète avec plus d'information, la mise en page et les images, veuillez cliquer ici.