I am just getting started with Red and I need help to get the cURL binding working.
The cURL link from the main red-lang site takes you here
http://red.esperconsultancy.nl/Red-cURL/dir?ci=tip
But there is only a small example using Red/System hence I am not sure how to load the binding in Red directly.
I need to get this working on Mac, Linux and maybe Windows so I would appreciate any pointers to differences between these platforms.
-m, --max-time <seconds> Maximum time in seconds that you allow the whole operation to take. This is useful for preventing your batch jobs from hanging for hours due to slow networks or links going down. Since 7.32.
cURL Command File Options -O will save the file in the current working directory with the same file name as remote. -o lets you specify a different file name or location.
-v (lower case letter v) means "verbose mode please" and will make curl show its request, the response headers and additional informational details about the transfer performed.
A few things to address:
Next, there are some dependencies between bindings. I am maintaining a github clone if you don't want to use the script download.r
in the Red-test files with Fossil. The cURL library explicitly depends on the C-library binding. I didn't look, but like depends on the Common binding at a lower level.
Because of the lack of url!
type in Red at the moment, you pass the function read-url
a string!
or a c-string!
more specifically.
With Red/System bindings used in Red, the ideal situation is to have a wrapper that abstracts the lower level code. You can see this on TryRebol with running read "http://www.google.com"
. Although this console build does not seem to use cURL binding for that implementation.
In order to use a Red/System binding in Red, you need to use the #system-global
directive. Here is a simple script that grabs the data from a website:
Red[]
#system-global [
#include %../cURL.reds
with curl [
print read-url "http://www.red-lang.org"
]
]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With