• This repository has been archived on 19/Jun/2023
  • Stars
    star
    14
  • Rank 1,392,923 (Top 29 %)
  • Language
    Crystal
  • License
    MIT License
  • Created over 7 years ago
  • Updated about 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Crystal C bindings for libcurl

libcurl for Crystal - PROJECT UNMAINTAINED Build Status

This project is not maintained anymore

If you like it or continue to use it fork it please.



Crystal C bindings for libcurl, the multiprotocol file transfer library - see libcurl

Installation

Add this to your application's shard.yml:

dependencies:
  curl-crystal:
    github: blocknotes/curl-crystal

Usage

CURL version:

require "curl-crystal"
puts String.new LibCurl.curl_version

Fetch an URL an print the content to the STDOUT:

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:

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&param2=12.345"
LibCurl.curl_easy_perform curl  # run
LibCurl.curl_easy_cleanup curl  # deinit

Invalid URL error:

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

Notes

Base on curl version: 7.52.1

Contributors

More Repositories

1

activeadmin_quill_editor

Quill Rich Text Editor for ActiveAdmin
JavaScript
142
star
2

activeadmin_dynamic_fields

ActiveAdmin plugin to add dynamic behaviors to fields
Ruby
113
star
3

magickwand-crystal

Crystal C bindings for MagickWand library
Crystal
66
star
4

prawn-html

HTML to PDF renderer using Prawn PDF
Ruby
55
star
5

kemal-rest-api

Crystal library to create REST API with Kemal
Crystal
54
star
6

activeadmin_blaze_theme

A theme for Active Admin based on Blaze CSS 3.x
SCSS
44
star
7

activeadmin_froala_editor

Froala WYSIWYG editor for ActiveAdmin
CSS
41
star
8

rails_admin_material

Material Design theme for RailsAdmin
Ruby
37
star
9

active_storage_db

An ActiveStorage service plugin to store files in a PostgreSQL / MySQL / MSSQL database (for Rails 6/7)
Ruby
30
star
10

activeadmin_trumbowyg

Trumbowyg Editor for ActiveAdmin
JavaScript
29
star
11

administrate_ransack

A plugin for Administrate to use Ransack for filtering resources
Ruby
29
star
12

activeadmin_active_resource

Active Admin + Active Resource: to use a REST API in place of a local database as data source
Ruby
28
star
13

activeadmin_medium_editor

Medium Editor for ActiveAdmin
JavaScript
28
star
14

sinatra-rest-api

Sinatra REST API generator
Ruby
26
star
15

activeadmin_select_many

ActiveAdmin plugin for one-to-many / many-to-many / many-to-one associations
Ruby
25
star
16

activeadmin_selectize

Selectize.js for ActiveAdmin
Ruby
24
star
17

administrate-bootstrap-theme

A Bootstrap 5 theme for Administrate
SCSS
22
star
18

wkhtmltopdf-crystal

Crystal C bindings and wrapper for libwkhtmltox library
Crystal
22
star
19

administrate-materialize-theme

A Material Design theme for Administrate based on Materialize framework
JavaScript
15
star
20

activeadmin_materialize_theme

A theme for Active Admin based on Materialize framework
JavaScript
13
star
21

prawn-styled-text

Prawn PDF component which adds basic HTML support
Ruby
13
star
22

activeadmin_jfu_upload

An ActiveAdmin plugin to use jQuery-File-Upload for file uploads in forms
Ruby
12
star
23

rails-vue-example

Starter project for Vue.js in Rails 4.x
Ruby
9
star
24

tiny_admin

A compact and composable dashboard component for Ruby
Ruby
9
star
25

eventish

A simple and composable event library
Ruby
8
star
26

activeadmin_simple_form

An ActiveAdmin 1.x plugin to use Simple Form in place of Formtastic in edit views
Ruby
8
star
27

just-pico

Simple Pico CMS theme made with PureCSS
CSS
6
star
28

rails_admin_mydash

RailsAdmin alternative dashboard
HTML
4
star
29

ruby_experiments

Some Ruby experiments
Ruby
3
star
30

http-mock-server

A Ruby HTTP Mock Server based on Sinatra
Ruby
3
star
31

contents_core

Simple structure to manage contents in a flexible way
Ruby
3
star
32

gumbo-crystal

Crystal C bindings for Gumbo library
Crystal
3
star
33

pico_debug

Debugging tool for Pico CMS
PHP
2
star
34

pinfo-rails

Command line utility to collect informations from a Ruby on Rails project
Ruby
2
star
35

active_job_store

Store jobs' state and custom data on DB
Ruby
2
star
36

rubocop-rbs

RucoCop extension that check RBS signatures
Ruby
2
star
37

editable_components

UI components editable from the front-end for Rails
JavaScript
2
star
38

phantomjs-sitemap-generator

nodejs module to generate sitemaps using PhantomJS
JavaScript
2
star
39

auto-seeding

Auto generate seeding data with ActiveRecord
Ruby
1
star
40

rails_full_page_cache

Sample project to use full page caching on Rails
Ruby
1
star
41

grape_by_examples

Some Grape experiments
Ruby
1
star
42

wordpress_category_featured_images

Wordpress plugin that allows to set featured images for categories
PHP
1
star
43

grape-starter-kit

A grape starter project
Ruby
1
star
44

rails_admin_extended_fields

RailsAdmin plugin to add more options to fields
Ruby
1
star