Bryan Field-Elliot wrote:
We are building a module which, among other things, needs to do a simple
HTTP GET (or HTTPS GET) from another website. Operationally this will be
very similar to what mod_proxy does, though our module serves a
completely different purpose.
My question is, in the Apache 2.x codebase, is there a simple API call,
in any of the utility files, which can make this easier for us?
e.g. an API call such as: "char* http_get(char* url)", which could be
invoked from any module...
I recommend that you use Serf:
http://svn.webdav.org/repos/projects/serf/trunk/
*cough* Someone still needs to make a website for Serf, but as a library
it works quite nicely.
For an example of using serf inside a module, checkout mod_serf, which
does reverse proxying:
http://people.apache.org/~pquerna/serf-stuff/mod_serf.c
Another option is libcurl:
http://curl.haxx.se/libcurl/
The curl_easy api is quite easy. If you just want simple GETs, it might
be the smallest lines of code to implement.
-Paul