You can use the API for curl or just check how the codebase for curl works:
http://wiki.freeswitch.org/wiki/Mod_curl -- src/mod/applications/mod_curl/
Or look at http://wiki.freeswitch.org/wiki/Mod_http_cache -- src/mod/applications/mod_http_cache/

-Avi