Using CURL with PclZip Class

SquirrelNutz

New Member
I'm using CURL to grab contents of a zip file on a remote server and then save it to a temp_zip_file.zip and then use PclZip class to extract the contents of a file.The problem is that on some servers, the server will not allow my script to create a temporary zip file out of the CURL return so I can use it for pclzip extraction. What i would like to do is skip the creation of a temporary zip file and just use the string return of the original CURL with pclzip class for extraction. I have to use pclzip because some servers do no allow the default php zip class to be used. Below is the curl function used to grab content from the remote file. \[code\]function copy_file($download_file){ //get file $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$download_file); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_FAILONERROR, true); curl_setopt($ch, CURLOPT_AUTOREFERER, true); curl_setopt($ch, CURLOPT_BINARYTRANSFER,true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); $file = curl_exec($ch); curl_close($ch); $fp = fopen('temp_zip_file.zip', 'w'); fwrite($fp, $file); fclose($fp); //exit;}\[/code\]Below is a copy of my pcl unzip function, in which $download_file is 'temp_zip_file.zip':\[code\]function zip_extract($download_file, $store_path, $remove_path){ //echo 1; exit; //echo $remove_path; exit; $archive = new PclZip($download_file); $list = $archive->extract(PCLZIP_OPT_REMOVE_PATH, $remove_path, PCLZIP_OPT_PATH, $store_path, PCLZIP_OPT_REPLACE_NEWER ); if ($list == 0) { //echo "death here"; exit; die("Error : ".$archive->errorInfo(true)); } else { //print_r($list); exit; return 1; }}\[/code\]Thank you for any support
 
Back
Top