Next: , Previous: , Up: Top   [Contents][Index]

1 Tutorial

This library has procedures that allow Guile to do client-side URL transfers, like requesting documents from http or ftp servers. It is based on the libcurl library.

Before using these functions, you must first load the library. If the library built and installed correctly, you should be able to load the library in the usual way by using (use-modules (curl)).

To transfer a file, you start off by creating a handle using curl-easy-init. curl-easy-init is a procecure that takes no arguments and returns a handle. The handle represents a single connection between computers using some standard protocol.

The handle holds opaque information used by the underlying libcurl library, so displaying it or writing it doesn’t produce much useful information beyond the location of a pointer in memory.

Before the handle can be used, it must first be given information about the connection and transfer that it will do. The procedure curl-easy-setopt is used to tell this handle’s connection how to behave. There are many dozens of options that can be set, but, at a minimum, it just needs a URL.

Then, to initiate the transfer, the procedure curl-easy-perform is called. For Guile-2.0, it can return the requested resource as either a bytevector or a string. If the data is returned as a string, no coding conversions will be performed, e.g., the program will presume that the data is in the Latin-1 encoding. For Guile-1.8 it returns the resource as a 8-bit string.

Next: , Previous: , Up: Top   [Contents][Index]