cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

Re: converting fopen and fread funtion to work as with CURL

From: <lobos_at_webvida.com>
Date: Sat, 10 Sep 2005 01:37:14 -0300

Ah it was not so hard after all!

function FetchAndGet($url) {
       
        $c = curl_init($url);
        curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
        $page = curl_exec($c);
        curl_close($c);
       
        return $page;
 }

Actually I think cURL works faster than fopen :)

lobos_at_webvida.com wrote:

> Hi there,
>
> Just switched to Dreamhost and have found that they don't allow fopen
> and fread... I have this little function and I was wondering if anyone
> could tell me if this could work with CURL and if so give me a few
> pointers on how to go about converting the function....
>
> Function FetchAndGet($url) {
> $tmon = fopen($url, "rb");
> while (!feof($tmon)) {
> $readfile = $readfile . fread($tmon, 1024);
> }
> fclose($tmon);
> return $readfile;
> }
>
> Thanks!
>
> Adam Docherty
>
> Daniel Stenberg wrote:
>
>> On Tue, 6 Sep 2005, Frederic Fleche wrote:
>>
>>> When I execute the following code lines I get an html code that list
>>> a ftp directory.
>>
>>
>>
>> When you use a (HTTP) proxy with a FTP URL, the protocol spoken is
>> effectively HTTP and not FTP. Thus the FTP-specific curl options no
>> longer have any effect.
>>
>
>
>
> __________ NOD32 1.1213 (20050909) Information __________
>
> This message was checked by NOD32 antivirus system.
> http://www.eset.com
>
>
>
Received on 2005-09-10