Curl doesn't handle memory stream

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I've got quite a strange problem with the curl library.

The following code does output Content||\Content instead of
Content|example.orgoutput|\Content

$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);


If I use a file stream instead it works as expected:

$c = curl_init("http://example.com";);

$file = "/tmp/phptest".rand()."";
touch($file);
$st = fopen($file, "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);
unlink($file);


What's the problem? Does PHP not support memory streams in Curl?

Peter

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux