Re: Curl doesn't handle memory stream

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

 



Nathan Nobbe wrote:
On Nov 29, 2007 10:59 AM, Peter Smit <peter@xxxxxxxxxxxx> wrote:

If nobody has a solution I think I'll report it as a bug tomorrow.


did you ever report a bug on this ?

i was messing around with it today, and i discovered that some urls,
partially work.  for example the google translate 'api', and php.net

note, i set the user agent for the google site to work.  and i say,
partially, because even when data does come back, its not the complete
page, which you can easily realize by navigating to the page and comparing
the source w/ the output from the test script.
i dont know of any ini setting that would influence the amount of space
available to the memory buffer, aside from memory_limit, which i have set
to 128M.

<?php
#$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);

echo stream_get_contents($st);
fclose($st);
?>

-nathan


I see on the http://us.php.net/wrappers.php page that only php 5.1.0 and newer have this feature. What version of PHP are you using?

--
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
       and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
    by William Shakespeare

--
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