php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #53392 curl_getcontent
Submitted: 2010-11-23 22:56 UTC Modified: 2020-12-04 17:45 UTC
From: martin dot k at atlas dot cz Assigned: cmb (profile)
Status: Closed Package: cURL related
PHP Version: 5.3.3 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: martin dot k at atlas dot cz
New email:
PHP Version: OS:

 

 [2010-11-23 22:56 UTC] martin dot k at atlas dot cz
Description:
------------
Please add function curl_getcontent similar to curl_multi_getcontent. Why?

When I call function curl_exec with set CURLOPT_TIMEOUT and timeout happend. It will return false and I have bad luck :-(

However when I call function curl_multi_exec also with set CURLOPT_TIMEOUT and timeout happend. It will return false as well, but then I can call function curl_multi_getcontent and get partial content of downloaded file :-)

Bottom line,
there is no simple way how to get content (including header & body) if function curl_exec ends up with fail. But if function curl_multi_exec will fail, I can call function curl_multi_getcontent and try get a part of content at least. Which can be useful!


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-11-27 21:16 UTC] cataphract@php.net
Well, you can use a write function to save the partial content.
 [2010-11-27 23:29 UTC] martin dot k at atlas dot cz
Yes, I can! But if I use curl multi functions, I can also use write function to save the partial content. So why is there curl_multi_getcontent function?

Moreover, it's very difficult to use write function (I must create new function, set up it for callback, manualy handle and store written data).

Same for case, when I can initialize curl_multi and use it only for download 1 file (I must call curl_init, curl_multi_init, curl_multi_add_handle then call curl_multi_exec in do-while cycle and more..)

In both of these case, the source code lost its brilliant simplicity :-(

As I wrote, there is no SIMPLE way how to do that. And if is requested function already implemented for multi curl, it should be easy make it for single curl.

The getcontent functions are not vital functions for cURL. As you said, everybody can use write function to save the partial content - this applies to single curl and also for multi curl!

I really don't understand, why is function implemented only for multi curl and not for single curl? Why to want make easy life only for multi curl and no for single curl? For both case of use, there is "ugly" alternative way (write function) to solve problem. And there should be great function getcontent also for both, not only for one...
 [2020-12-04 17:45 UTC] cmb@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2020-12-04 17:45 UTC] cmb@php.net
curl_multi_getcontent() is a misnomer; actually, the function has
nothing to do with cURL multi handles, but works on vanilla cURL
handles.  As such there is nothing to add.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 06:01:30 2024 UTC