I am trying to receive a .zip file that's been chunked.
Here is my code :
// cUrl function
function send_request($url, $xml, $path, $save = TRUE){
    if($save == TRUE){
        $file = fopen($path, 'w'); // create a new file
    }
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    if($save == TRUE){
        curl_setopt($ch, CURLOPT_FILE, $file); // save data direct to file
    } else {
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    }
    curl_setopt($ch, CURLOPT_HEADER, 1);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: text/xml'));
    curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
    $response = curl_exec($ch);
    curl_close($ch); // close curl conn
    if($save == TRUE){
        fclose($file); // close the file
    }
    return $response;
}
$zip = send_request($url, $xml_product, './xml_product_response.zip', TRUE);
It seems to be working, the above code creates a file with lots of strange characters with headers.
I am now stuck, because I need to unzip and read the data from the file.
Can anyone help with that please?
