curl-crystal
Version, currently 0.1.03 versions
- 0.1.3latestSep 28, 2019
- 0.1.2not indexedApr 12, 2020
- 0.1.0not indexedApr 12, 2020
github.com/blocknotes/curl-crystal
Crystal C bindings for libcurl
16 stars
0 dependents
License: MIT
Nothing has been indexed for 0.1.0 yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.
Installation
# Add this to your shard.yml
dependencies:
curl-crystal:
github: blocknotes/curl-crystal
version: ~> 0.1.0Then run:
shards installshard.yml
No shard.yml has been indexed for 0.1.0. You can read it on the repository.
Dependencies
Unknown: the shard.yml for this version has not been read yet.
README
This README is the one indexed from the repository at its latest ref, not from the tag for this version.
# libcurl for Crystal [](https://travis-ci.org/blocknotes/curl-crystal)
Crystal C bindings for libcurl, the multiprotocol file transfer library - see [libcurl](https://curl.haxx.se/libcurl/)
## Installation
Add this to your application's `shard.yml`:
```yaml
dependencies:
curl-crystal:
github: blocknotes/curl-crystal
```
## Usage
CURL version:
```ruby
require "curl-crystal"
puts String.new LibCurl.curl_version
```
Fetch an URL an print the content to the STDOUT:
```ruby
require "curl-crystal"
curl = LibCurl.curl_easy_init # init
LibCurl.curl_easy_setopt curl, LibCurl::CURLoption::CURLOPT_URL, "https://www.google.com" # set URL
LibCurl.curl_easy_setopt curl, LibCurl::CURLoption::CURLOPT_FOLLOWLOCATION, 1 # follow redirect
LibCurl.curl_easy_perform curl # run
LibCurl.curl_easy_cleanup curl # deinit
```
Simple POST request:
```ruby
require "curl-crystal"
curl = LibCurl.curl_easy_init # init
LibCurl.curl_easy_setopt curl, LibCurl::CURLoption::CURLOPT_URL, "http://localhost"
LibCurl.curl_easy_setopt curl, LibCurl::CURLoption::CURLOPT_POSTFIELDS, "param1=Just+a+test¶m2=12.345"
LibCurl.curl_easy_perform curl # run
LibCurl.curl_easy_cleanup curl # deinit
```
Invalid URL error:
```ruby
require "curl-crystal"
curl = LibCurl.curl_easy_init
LibCurl.curl_easy_setopt curl, LibCurl::CURLoption::CURLOPT_URL, "https://aaa.bbb.ccc.ddd"
ret = LibCurl.curl_easy_perform curl # CURLE_COULDNT_RESOLVE_HOST
puts ret.to_s + ": " + String.new( LibCurl.curl_easy_strerror( ret ) )
LibCurl.curl_easy_cleanup curl
```
## More examples
- [examples](https://github.com/blocknotes/curl-crystal/tree/master/examples) folder
- libcurl C [examples](https://curl.haxx.se/libcurl/c/example.html)
## Notes
Base on curl version: **7.52.1**
## Contributors
- [Mattia Roccoberton](http://blocknot.es) - creator, maintainer, Crystal fan :)
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.1.0- Tagged
- Apr 12, 2020
- Commit
f076bc10aa13- Indexed
- not yet
Dependents
No indexed shard depends on this one yet.
Repository
github.com/blocknotes/curl-crystal
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 13, 2026
- Synced
- Aug 13, 2026
- Versions
- 3