note 109167 added to function.curl-multi-exec
| From: | emmet at trovit dot com | Date: | Mon, 25 Jun 2012 16:57:57 +0000 |
| Subject: | note 109167 added to function.curl-multi-exec | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-188789@lists.php.net to get a copy of this message | ||
Here's something that had me pulling my hair out for quite a while. I was trying to download
multiple files and save each one in a file. If you want to read the file again in the same script
that has downloaded the url, always make sure to close the original filehandle that you opened for
the connection BEFORE trying to read from the file again, even if you open a new filehandle to do
so. If you don't do this, a file_get_contents() or fread() will cut your file and only return a
limited size of it, 40960 characters in my case, without any other explanation or error. The file
will exist (and be complete) on your disk, PHP just wont show it.
I (perhaps mistakenly) thought this was a bug so I created a bug report, see it for examples of the
code I used to recreate this misterious behavior:
https://bugs.php.net/bug.php?id=62409
----
Server IP: 69.147.83.197
Probable Submitter: 213.229.152.189
----
Manual Page -- http://www.php.net/manual/en/function.curl-multi-exec.php
Edit -- https://master.php.net/note/edit/109167
Del: integrated -- https://master.php.net/note/delete/109167/integrated
Del: useless -- https://master.php.net/note/delete/109167/useless
Del: bad code -- https://master.php.net/note/delete/109167/bad+code
Del: spam -- https://master.php.net/note/delete/109167/spam
Del: non-english -- https://master.php.net/note/delete/109167/non-english
Del: in docs -- https://master.php.net/note/delete/109167/in+docs
Del: other reasons-- https://master.php.net/note/delete/109167
Reject -- https://master.php.net/note/reject/109167
Search -- https://master.php.net/manage/user-notes.php