note 64083 added to function.curl-setopt
| From: | ceo at l-i-e dot com | Date: | Fri, 07 Apr 2006 05:00:20 +0000 |
| Subject: | note 64083 added to function.curl-setopt | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-107482@lists.php.net to get a copy of this message | ||
If the data you are getting is BINARY, such as, say, a JPEG image, then you need to use
CURLOPT_BINARYTRANSFER.
Otherwise PHP/curl will return what seems to be a valid JPEG, and you can even view it in a browser,
but, in reality, PHP/curl will have corrupted the JPEG.
I'm not sure if it stops at the NULL character, or if it does CRLF conversion or what, but if
you try to use it in, say, imagecreatefromstring() you are going to have problems.
Sometimes I got error messages saying "Not a JPEG." and listing some bytes that were known
to be wrong.
More often, I got segfaults. :-(
The truly weird thing, to my mind, is that browsers are tolerant enough to show you a perfectly fine
image if you dump the data to a file and look at it.
I must have spent an hour or two trying to figure this out.
Hopefully, now you'll find this note and save yourself that hour.
----
Server IP: 64.71.164.2
Probable Submitter: 67.184.121.112
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.curl-setopt.php
Edit -- http://master.php.net/note/edit/64083
Del: integrated -- http://master.php.net/note/delete/64083/integrated
Del: useless -- http://master.php.net/note/delete/64083/useless
Del: bad code -- http://master.php.net/note/delete/64083/bad+code
Del: spam -- http://master.php.net/note/delete/64083/spam
Del: non-english -- http://master.php.net/note/delete/64083/non-english
Del: in docs -- http://master.php.net/note/delete/64083/in+docs
Del: other reasons-- http://master.php.net/note/delete/64083
Reject -- http://master.php.net/note/reject/64083
Search -- http://master.php.net/manage/user-notes.php