cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: can curl output to a string?

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 14 Nov 2000 17:11:46 +0100 (MET)

On 14 Nov 2000, Miguel Mendes wrote:

> I'm doing some web fetching, something like this:
>
> $url = "http://www.some-site.com/index.html"
>
> $ch = curl_init ($url);
> $fp = fopen ($url, "w");
>
> curl_setopt ($ch, CURLOPT_FILE, $fp);
>
> curl_exec ($ch);
> curl_close ($ch);
> fclose ($fp);

This is obviously the curl module for PHP4 you're talking about.

Sterling Hughes of the PHP team is the one who's written that module if I'm
not mistaking.

I've never even used it.

> Is there a way to output the fetched page directly to a string, avoiding
> writing to a file?

The curl module for PHP has a glue layer between PHP and libcurl. It could
indeed be written to collect all contents into a "string". This isn't really
a limitation in curl (even though libcurl's design limits some things). This
is merely a design choice of that module.

I'm sorry, but this suggestion should probably be sent to the curl module
author.

-- 
  Daniel Stenberg -- curl project maintainer -- http://curl.haxx.se/
Received on 2000-11-14