Hi,

anyone aware of a problem where fwrite stops writing when hitting the \x00
character.

I'm downloading a zip file into a string with curl, then trying to write it
to disk:



$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, MABEL_URL.'/export');
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADERFUNCTION, 'readHeader');

$return = curl_exec($ch);
curl_close();

$fn = TMP_FILE_FOLDER.'/'.$GLOBALS['fileName2Save'];
$fh = fopen ($fn,'w+b');
$x = fwrite($fh, strlen($return));
fclose($fh);


--> $x returns 4.

$return looks fine in my debugger, roughly like this:

PK\x03\x04\x14\x00\x00\x00\x08\x00ö
“=“.\x02Ò£\x01\x00\x00ˆ\x06\x00\x00"\x00\x00\x00R20101219_598983_APS0001_10000.XML.......



Any ideas what I;m doing wrong?

Thanks for any help.

Kind Regards,\

Jochen

-- 
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[email protected]

Reply via email to