Asterisk - The Open Source Telephony Project GIT-master-f36a736
|
Modules | |
Header Callback | |
Received Data Callback | |
Open Socket Callback | |
Optional Data | |
Structure pased to ast_curler with infrequenty used control data. | |
Making Requests | |
While libcurl is extremely flexible in what it allows you to do, that flexibility comes at complexity price. The convenience wrappers defined here aim to take away some of that complexity for run-of-the-mill requests.
If all you need to do is receive a document into a buffer...
If you need the headers as well...
If you need more control, you can specify callbacks to capture the response headers, do something other than write the data to a memory buffer, or do some special socket manipulation like check that the server's IP address matched an acl.
Let's write the data to a file, capture the headers, and make sure the server's IP address is whitelisted.
The default callbacks can do that so all we need to do is supply the data.
If you need even more control, you can supply your own callbacks as well. This is a silly example of providing your own write callback. It's basically what ast_curler_write_to_file() does.