Can anybody expand on the meaning and correct usage of: CURLOPT_BINARYTRANSFER Just so you know this is not a question with no effort to find out for myself behind it... :-) So far, I've found these: http://php.net/curl_setopt TRUE to return the raw output when CURLOPT_RETURNTRANSFER is used. That's kinda self-referential, to tell you the truth... I haven't really learned anything new from the docs than I could deduce from the words "binary" and "transfer" http://blog.unitedheroes.net/archives/p/1630/ Another guy at least as confused as me, if not more so http://curl.haxx.se/mail/curlphp-2002-06/0029.html "You don't need the BINARYTRANSFER option (I'm not even sure what this does)" He seems to know what he's talking about... But I'm not quite getting the context, so maybe *I* need it even if his OP didn't. http://www.roadsend.com/p/forum/viewThread.php?mID=6e9a196a14179d25c04382132043e38c&pageID=comForum&expandedIds=c83be39d0fbed2393d8cd1c7accaf9f7 "That option is not an actual curl option, in fact -- it has something to do with PHP's own internals." [nb] Which would go a long way to explaining why I'm not finding BINARYTRANSFER documented on the curl site, eh? It's strictly a PHP internals thing? [/nb] Now, just from what I've got so far... There are two rational explanations for this option, both equally valid, that *I* personally can think of: #1. If you want to get binary data through curl, such as a JPEG/GIF or whatever, you need this so PHP will not treat the data as a null-terminated string, but will store it as a binary string internally. #2. You only need this in FTP to switch from ASCII to BINARY mode. In my own personal experimentation, I have *SOME* evidence that #1 is correct: If I use curl to snag some HTML, then parse an IMG tag, then use curl to snag that JPEG URL, then pass that JPEG to imagecreatefromstring() I get a lot less errors and segfaults if I use BINARYTRANSFER. Unfortunately, *after* I have used: curl_setopt($curl, CURLOPT_BINARYTRANSFER, 1); $jpeg = curl_exec($curl); I need to snag another page of HTML so I do: curl_setopt($curl, CURLOPT_BINARYTRANSFER, 0); $html = curl_exec($curl); Seems reasonable, right? Unfortunately, at THAT point, all hell breaks loose. Specifically, the following are all (usually) true: #1 The HTML I snag has all kinds of junk characters tacked onto the end: <html>...</html>ZZZZZZZZZZZZZZZZZZZ?98q7w4njkvn438jio #2 I get messages like: ht=0x12345678 being cleaned And the script just sorta ends in the middle... A Google for this yielded PHP Source: http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_hash.c?view=markup Seeing as how the function is named "_zend_is_inconsistent" and it's taking a HashTable as an arg, and if the check was HT_OK it just returns, and my error message comes after that, and it is followed by a call to "zend_bailout()"... I'm thinking I've managed to scramble PHP's RAM hash table of data/variables or something in a very bad way, right?... I've got a bug report already filed under that assumption, but the point of all this is that maybe I'm just being stoopid and using CURLOPT_BINARYTRANSFER when I shouldn't, cuz I got no idea what it's really for... Anybody got a clue to lend? Thanks for listening. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php