Brian Takita
2005-07-29 02:21:01 UTC
Hello,
I'm trying to figure out how to use libcurl via ruby-dl.
Here is some good documentation I found about ruby-dl.
http://www.jbrowse.com/text/rdl_en.html
I read _Why's intro to using libcurl at,
http://whytheluckystiff.net/articles/rubyOneEightOh.html, which is an
exciting but shallow introduction.
Right now, I am having trouble setting the url parameter by calling
curl_easy_setopt.
Here is libcurl's documentation that I am trying to grok:
http://curl.mirror.internet.tp/libcurl/c/curl_easy_setopt.html
What I have so far is at the end of this message. Unforunately, my C
knowledge is lacking that I am not confident how to finish this test
script.
Can somebody help me to get a simple request working with libcurl and
Ruby?
Thank you,
Brian Takita
require 'dl/import'
require 'dl/struct'
module Curl
extend DL::Importable
dlload "libcurl.dll"
typealias('CURL', 'void')
typealias('CURLOPT', 'long')
extern "CURL *curl_easy_init()"
extern "char *curl_version()"
extern "void *curl_version_info(int)"
extern "void curl_easy_setopt(CURL *, CURLOPT, char *)"
extern "curl_easy_cleanup(CURL *)"
VersionInfoData = struct [
"int age",
"char *version",
"uint version_num",
"char *host",
"int features",
"char *ssl_version",
"long ssl_version_num",
"char *libz_version",
"char **protocols"
]
end
handle = Curl.curl_easy_init
url_param = 0 # I don't know the value
Curl.curl_easy_setopt(handle, url_param, 'http://www.google.com')
# This also fails
# Documentation is at
http://curl.mirror.internet.tp/libcurl/c/curl_easy_cleanup.html
Curl.curl_easy_cleanup(handle)
I'm trying to figure out how to use libcurl via ruby-dl.
Here is some good documentation I found about ruby-dl.
http://www.jbrowse.com/text/rdl_en.html
I read _Why's intro to using libcurl at,
http://whytheluckystiff.net/articles/rubyOneEightOh.html, which is an
exciting but shallow introduction.
Right now, I am having trouble setting the url parameter by calling
curl_easy_setopt.
Here is libcurl's documentation that I am trying to grok:
http://curl.mirror.internet.tp/libcurl/c/curl_easy_setopt.html
What I have so far is at the end of this message. Unforunately, my C
knowledge is lacking that I am not confident how to finish this test
script.
Can somebody help me to get a simple request working with libcurl and
Ruby?
Thank you,
Brian Takita
require 'dl/import'
require 'dl/struct'
module Curl
extend DL::Importable
dlload "libcurl.dll"
typealias('CURL', 'void')
typealias('CURLOPT', 'long')
extern "CURL *curl_easy_init()"
extern "char *curl_version()"
extern "void *curl_version_info(int)"
extern "void curl_easy_setopt(CURL *, CURLOPT, char *)"
extern "curl_easy_cleanup(CURL *)"
VersionInfoData = struct [
"int age",
"char *version",
"uint version_num",
"char *host",
"int features",
"char *ssl_version",
"long ssl_version_num",
"char *libz_version",
"char **protocols"
]
end
handle = Curl.curl_easy_init
url_param = 0 # I don't know the value
Curl.curl_easy_setopt(handle, url_param, 'http://www.google.com')
# This also fails
# Documentation is at
http://curl.mirror.internet.tp/libcurl/c/curl_easy_cleanup.html
Curl.curl_easy_cleanup(handle)