code html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> decompresseur de xml </title>
</head>
<body>
<center>
<br><br><br><br><br><br>
<table border="10" bordercolor= "#ff0000">
<tr><td>
<h2><center><label>Entrer le chemin de votre xml ( .gz .z .xmlphp ) <br> a <br> decompresser <br> ou <br> a <br> compresser</label></center></h2></font>
<form>
<p>
<center>
<input size="65" type="text" value="c:\chemin de votre xml">
<button type="submit" name="decompresser" value="decompress" onclick="decompress($fd);">
<img src="http://www.dicollecte.org/img/forum/solved_overlay_big.png" alt=""><font size="5" color="#66cc00">decompress</font>
</button>
</center>
<p>
<center>
<input size="65" type="text" value="c:\chemin de votre xml">
<button type="button" name="compresser" value="compress" onclick="compress($fd);" >
<img src="http://www.dicollecte.org/img/forum/solved_overlay_big.png" alt=""><font size="5" color="#66cc00">compresser </font>
</button>
</center>
</form>
</tr></td>
</table>
<style type="text/css">
body
{
background-color: #6666cc
}
label
{
color: #33ccff
}
input
{
background-color: #33ccff
}
button
{
border-bottom-color: #33ccff
border-width: 80px
}
img
{
font-size-adjust: 50px
}
</style>
</body>
</html>
les code php gz_workRun.php
<?php
include('gz_workClass.php');
$gz=new gz_work();
if (strcmp($argv[1], 'decompress') == 0) {
$gz->decompress($argv[2]);
}
if (strcmp($argv[1], 'compress') == 0) {
$gz->compress($argv[2]);
}
?>
gz_workClass.php<?php
class gz_work{
function decompress($fd){
$fr = fopen($fd, 'r');
$fl = fread($fr, filesize($fd));
fclose($fr);
$fn = strrev($fd);
$fn = substr($fn, 3, strlen($fn)-3);
$fn = strrev($fn);
$fw = fopen($fn, 'w');
fwrite($fw, gzuncompress($fl));
fclose($fw);
echo 'Decompressing finished' . "\n";
}
function compress($fd){
$fr = fopen($fd, 'r');
$fl = fread($fr, filesize($fd));
fclose($fr);
$fn = $fd . '.gz';
$fw = fopen($fn, 'w');
fwrite($fw, '02GM' . base64_encode(gzcompress($fl)));
fclose($fw);
echo 'Compressing finished' . "\n";
}
}
?>