MongoosePeople. Places. Questionable inventions.

All help topics · Link to this topic

Showing help on 'curl()'

Syntax: curl(STR <url> [, INT <include_headers> [, INT timeout]]) => STR

The curl builtin will download an HTTP, HTTPS, or DICT URL and return it as a string. If <include_headers> is true, the HTTP headers will be included in the return string.

The programmer must be a wizard, or E_PERM is raised. If outbound networking is disabled at runtime, curl() raises E_PERM with a value indicating that outbound network connections are disabled.

It's worth noting that the data you get back will be binary encoded. In particular, you will find that line breaks appear as ~0A. You can easily convert a page into a list by passing the return string into the decode_binary() function.

CURL_TIMEOUT is defined in options.h to specify the maximum amount of time a CURL request can take before failing. For special circumstances, you can specify a longer or shorter timeout using the third argument of curl().