ID:               43468
 User updated by:  peter at petersmit dot eu
 Reported By:      peter at petersmit dot eu
-Status:           No Feedback
+Status:           Open
 Bug Type:         cURL related
 Operating System: Ubuntu Linux Gutsy Gibbon
 PHP Version:      5.2.5
 New Comment:

Confirmed solved


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

[2008-12-10 01:55:55] dan dot hitt at gmail dot com

I can reproduce the bug.

I downloaded the link provided on the bug by jani (php 5.2 snapshot).

I built php (and had to also download and build libcurl).

My exact configuration line for the php was:
./configure --prefix=/home/danh/staging/php/2008_09_12_c
--with-curl=/home/danh/staging/curl/2008_09_12
where the funky directory name is where i installed the curl i built. 
(For the curl i used no options in the configuration except where to
install it.)

My system is ubuntu 7.10.

It would be terrific to fix the bug because curl is so useful and
having arbitrary streams is so useful: at least streams to memory.

Thanks everybody for your efforts on refining php.

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

[2008-11-04 01:00:01] 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-10-27 12:57:39] [EMAIL PROTECTED]

Please try using this CVS snapshot:

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

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

If it still does not work, please provide the full configure line you
have used.

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

[2008-02-13 22:16:29] quickshiftin at gmail dot com

i have discovered that this does work, partially, for some urls.
im not sure what is preventing this from working on all urls, but even
for ones where it does work, the entire result is not placed in the
buffer.
here is a modification of peters code, which illustrates 2 urls that
work partially, one is the google translate 'api', the other is
php.net.

<?php
#$c = curl_init("http://example.com";);
#$c =
curl_init("http://google.com/translate_t?langpair=en%7Cfr&text=newspaper";);
$c = curl_init("http://php.net";);
$st = fopen('php://memory', 'r');

curl_setopt($c, CURLOPT_FILE, $st);
curl_setopt($c, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; U; Linux i686;
en-US; rv:1.8.1.11) Gecko/20080115 Firefox/2.0.0.11');

if(!curl_exec($c)) die ("error: ".curl_error($c));
curl_close($c);


rewind($st);
/*
$str =  fgets($st);
var_dump($str);
*/
echo stream_get_contents($st);
#echo
"Content|".htmlspecialchars(stream_get_contents($st))."|/Content";
fclose($st);
?>

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

[2007-12-01 10:00:25] peter at petersmit dot eu

Description:
------------
If you use a php://memory stream in combination with curl, nothing is
written to the stream.

A filestream works fine.

Reproduce code:
---------------
<?php

$c = curl_init("http://example.com";);
$st = fopen("php://memory", "r+");

curl_setopt($c, CURLOPT_FILE, $st);

if(!curl_exec($c)) die ("error: ".curl_error($c));

rewind($st);
echo
"Content|".htmlspecialchars(stream_get_contents($st))."|/Content";
fclose($st);

?>

Expected result:
----------------
Content|The content of example.org|/Content

Actual result:
--------------
Content||/Content


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


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

Reply via email to