Re: Curl doesn't handle memory stream

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

 



Hello,

on 02/13/2008 05:17 PM Nathan Nobbe said the following:
>> 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);
> ?>

It does not seem like it is a real bug but maybe file access is
implemented inside Curl and it has no knowledge about PHP stream support.

Alternatively, you may want to try this HTTP client class, which can use
any access files you need to use in your HTTP requests.

-- 

Regards,
Manuel Lemos

PHP professionals looking for PHP jobs
http://www.phpclasses.org/professionals/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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