cURL / Mailing Lists / curl-library / Single Mail

curl-library

Curl in PHP (fwd)

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 12 Aug 2002 14:42:35 +0200 (MET DST)

I think this is a splendid idea.

We could possibly use the already existing curl_easy_getinfo() for this
(except that this particular request isn't really dependent on an easy
handle).

I've already before been thinking about adding some kind of possibility to
get the exact version number from the running libcurl in a suitable format
(the ascii string isn't that programmer friendly) and it could possibly be
added using the same kind of interface.

Anyone feels like providing a patch for something like this?

-- 
 Daniel Stenberg -- curl related mails on curl related mailing lists please
---------- Forwarded message ----------
Date: Mon, 12 Aug 2002 12:47:30 +0100
From: Wez Furlong <wez_at_thebrainroom.com>
To: Daniel Stenberg <daniel_at_haxx.se>
Cc: Wez Furlong <wez_at_thebrainroom.com>,
     Sterling Hughes <sterling_at_bumblebury.com>
Subject: Curl in PHP
Hi Daniel,
I've got a little "feature" request - here's some background:
The streams system in PHP can register protocol wrappers using
the scheme part of the protocol.  Each protocol is registered
separately, but can re-use the underlying wrapper.  When the
curl extension is initialized by PHP it does this:
php_register_url_stream_wrapper("http", &php_curl_wrapper TSRMLS_CC);
Now, since we will want to use the curl wrapper for all of the
curl protocols (perhaps with one or two exceptions), it would be
nice to have some way of enumerating the protocols that curl supports
at runtime.  Then we could do something like this:
/* returns an argv style array of strings, with the final entry
   marked by a NULL. */
char **protocols = curl_enum_protocols();
int i = 0;
while(protocols[i]) {
   php_register_url_stream_wrapper(protocols[i],
       &php_curl_wrapper TSRMLS_CC);
   i++;
}
The argv style thing is probably the simplest to implement, but you
may want to return an array of structures with additional features
for each protocol or whatever.
The nice thing about doing it at runtime is that we don't have to
have ifdefs for protocol support, and if the admin updates libcurl,
PHP will automatically support any new protocols without having to
have code added to it and recompiled.
--Wez.
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Received on 2002-08-12