I have written a small php script to handle unzipping for me. I can call it from any other script, in my case from a perl script I have and just pass the relevant filename and target directory. my problem is I'd like to get the filename back to confirm success but I cannot get the php to print out plain text. It always prints back the headers. Can I get php to print without headers? Tried the header_remove but it does not work.
<?php
header_remove();
if (!headers_sent()) { foreach (headers_list() as $header) header_remove ($header); }
require("dUnzip2.inc.php");
$Path = $_GET["path"];
$save_to = $_GET["save_to"];
$filename = $_GET["filename"];
$zip_file = "$Path/$filename";
$zip = new dUnzip2("$zip_file");
$zip->debug = 0;
$zip->unzipAll("$save_to");
unlink("$Path/$filename");
echo "$filename was uploaded and unpacked.";
?>
The response I get from the script is:
HTTP/1.1 200 OK
Connection: close
Date: Thu, 19 Jul 2012 20:40:04 GMT
Server: Nginx / Varnish
Content-Length: 38
Content-Type: text/html
Client-Date: Thu, 19 Jul 2012 20:40:04 GMT
Client-Peer: 66.86.255.11:80
Client-Response-Num:
Foo.zip was uploaded and unpacked.
I want it to be just:
Foo.zip was uploaded and unpacked.
EDIT: SOLVED I got it to work, I was using
my $response = $ua->request($req)->as_string;
When I should have used
my $response = $ua->request($req)->content;
in my PERL script, thank you, I was looking at everthing but where I needed to.