ID:               43468
 Comment by:       davirtavares at gmail dot com
 Reported By:      peter at petersmit dot eu
 Status:           No Feedback
 Bug Type:         cURL related
 Operating System: Ubuntu Linux Gutsy Gibbon
 PHP Version:      5.2.6
 New Comment:

Well, I just discovered that I can use fstat to get the size of a
stream (even memory ones).

Follows the test case:

$fi = fopen('php://temp', 'rb+');

// fill the $fi stream with some data

$input_stat = fstat($fi);
$input_size = $input_stat['size'];

curl_setopt($ch, CURLOPT_PUT, true);
curl_setopt($ch, CURLOPT_INFILE, $fi);
curl_setopt($ch, CURLOPT_INFILESIZE, $input_size);

curl_exec($ch);

Davi


Previous Comments:
------------------------------------------------------------------------

[2009-01-29 00:06:27] davirtavares at gmail dot com

I got the same problem. I'm trying to submit data by PUT request and
aparently memory streams don't work for just a single CURL option:

curl_setopt($ch, CURLOPT_INFILESIZE, $input_size);

Aparently some servers don't like when you submit data w/o the
content-size.

But... how to obtain the size of a memory stream?

Davi

------------------------------------------------------------------------

[2008-12-18 01:00:00] php-bugs at lists dot php dot net

No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".

------------------------------------------------------------------------

[2008-12-11 02:41:48] dan dot hitt at gmail dot com

I built again, and tried Peter's test again, and it failed again.

But note that with either the build from today or yesterday it
gives partial results for the wikipedia (it looks like it loses
the last 497 characters).

My configuration command is:

./configure --prefix=/home/danh/staging/php/2008_12_11_a
--with-curl=/home/danh/staging/curl/2008_09_12

dan

------------------------------------------------------------------------

[2008-12-11 00:06:56] [email protected]

Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/

And provide the full configure line you used if the snapshot does not 
work.

------------------------------------------------------------------------

[2008-12-10 07:09:35] peter at petersmit dot eu

Sorry, not confirmed

I was checking it whit my own website address in the example code and
everything looked fine. However with example.org or google.com it's not
working!

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/43468

-- 
Edit this bug report at http://bugs.php.net/?id=43468&edit=1

Reply via email to