All Projects → libetl → curl

libetl / curl

Licence: Unlicense license
cURL command in full java. Any argument/option you need raise an issue here.

Programming Languages

java
68154 projects - #9 most used programming language
shell
77523 projects

Labels

Projects that are alternatives of or similar to curl

curl-worker
No description or website provided.
Stars: ✭ 42 (-59.22%)
Mutual labels:  curl
php-curl-cookbook
PHP CURL Cookbook 📖
Stars: ✭ 83 (-19.42%)
Mutual labels:  curl
guile-curl
A language binding for the CURL network client library for the Guile version of the Scheme language
Stars: ✭ 23 (-77.67%)
Mutual labels:  curl
opencv3-setup
Raspberry Pi whiptail Menu driven Easy Install and Compile of opencv3 python from source files.
Stars: ✭ 47 (-54.37%)
Mutual labels:  curl
libopenTIDAL
TIDAL API interface written in ANSI C
Stars: ✭ 17 (-83.5%)
Mutual labels:  curl
textics
📉 JavaScript Text Statistics that counts lines, words, chars, and spaces.
Stars: ✭ 36 (-65.05%)
Mutual labels:  curl
cj
正方教务系统成绩查询手机版,结合Weui,自动识别验证码
Stars: ✭ 20 (-80.58%)
Mutual labels:  curl
pg curl
PostgreSQL curl allows most curl actions, including data transfer with URL syntax via HTTP, HTTPS, FTP, FTPS, GOPHER, TFTP, SCP, SFTP, SMB, TELNET, DICT, LDAP, LDAPS, FILE, IMAP, SMTP, POP3, RTSP and RTMP
Stars: ✭ 30 (-70.87%)
Mutual labels:  curl
axios-curlirize
axios plugin converting requests to cURL commands, saving and logging them.
Stars: ✭ 152 (+47.57%)
Mutual labels:  curl
easyhttp
EasyHttp 是一个轻量级、语义化、对IDE友好的HTTP客户端,支持常见的HTTP请求、异步请求和并发请求,让你可以快速地使用 HTTP 请求与其他 Web 应用进行通信。
Stars: ✭ 31 (-69.9%)
Mutual labels:  curl
squirrel
Like curl, or wget, but downloads directly go to a SQLite databse
Stars: ✭ 24 (-76.7%)
Mutual labels:  curl
GitHubAPI
[UNMAINTAINED] This is a simple Object Oriented wrapper for GitHub API v3, written with PHP7.
Stars: ✭ 36 (-65.05%)
Mutual labels:  curl
fortran-curl
Fortran 2008 interface bindings to libcurl
Stars: ✭ 25 (-75.73%)
Mutual labels:  curl
orca
C Multi-REST API library for Discord, Slack, Reddit, etc.
Stars: ✭ 360 (+249.51%)
Mutual labels:  curl
Speedport-Plus-Cosmote-Router-hacks
Exploring the Sercomm made router of Cosmote - OTE Group (Deutsche Telekom in Greece)
Stars: ✭ 64 (-37.86%)
Mutual labels:  curl
Fetch
Asynchronous HTTP client with promises.
Stars: ✭ 29 (-71.84%)
Mutual labels:  curl
boast
I want track all HTTP requests, and replay it easily.
Stars: ✭ 61 (-40.78%)
Mutual labels:  curl
r2curl
Node.js Request Wrapper (axios, fetch, ..) to cURL Command String
Stars: ✭ 30 (-70.87%)
Mutual labels:  curl
curl2ab
Convert cURL command line to ab (apache bench)
Stars: ✭ 22 (-78.64%)
Mutual labels:  curl
1c http
Подсистема 1С для работы с HTTP
Stars: ✭ 48 (-53.4%)
Mutual labels:  curl

curl License: Unlicense

curl command in java (using Apache libs : HttpClient and commons-cli)

Setup with maven

<dependency>

    <groupId>org.toile-libre.libe</groupId>

    <artifactId>curl</artifactId>

    <version>LATEST</version>

</dependency>

Usage

    org.apache.http.HttpResponse org.toilelibre.libe.curl.Curl.curl (String curlParams);
    String org.toilelibre.libe.curl.Curl.$ (String curlCommand); //Returns responseBody

You can import static these methods :

    import static org.toilelibre.libe.curl.Curl.curl;
    import static org.toilelibre.libe.curl.Curl.$;

Examples :

    $("curl https://localhost:8443/public/");
    $("curl -k https://localhost:8443/public/");
    curl("-k https://localhost:8443/public/");
    curl("-k --cert src/test/resources/client.p12:password https://localhost:8443/public/");
    curl("-k https://localhost:8443/public/redirection");
    curl("-k https://localhost:8443/public/unauthorized");
    curl("-k -L https://localhost:8443/public/redirection");
    curl("-k -H'Host: localhost' -H'Authorization: 00000000-0000-0000-0000-000000000000' https://localhost:8443/public/v1/coverage/sncf/journeys?from=admin:7444extern");
    curl("-k -X GET -H 'User-Agent: curl/7.49.1' -H 'Accept: */*' -H 'Host: localhost'  'https://localhost:8443/public/curlCommand1?param1=value1&param2=value2'");
    curl("-k -X GET -H 'User-Agent: curl/7.49.1' -H 'Accept: */*' -H 'Host: localhost' -u foo:bar 'https://localhost:8443/private/login'");
    curl("-L -k -X GET -H 'User-Agent: curl/7.49.1' -H 'Accept: */*' -H 'Host: localhost' -u user:password 'https://localhost:8443/private/login'");
    curl("-k -X POST 'https://localhost:8443/public/json' -d '{\"var1\":\"val1\",\"var2\":\"val2\"}'");

It also works with a builder

    HttpResponse response = curl().k().xUpperCase("POST").d("{\"var1\":\"val1\",\"var2\":\"val2\"}").run("https://localhost:8443/public/json");

How to get Google Homepage with this lib :

    public String getGoogleHomepage (){
        //-L is passed to follow the redirects
        return curl ().lUpperCase ().$ ("https://www.google.com/");
    }

You can also specify three additional curl options using jvm code :

  • javaOptions.interceptor can be used to surround the call with a custom handling
  • javaOptions.placeHolders allows to define substitution variables (useful mostly for long payloads to avoid StackOverflowErrors)
  • javaOptions.connectionManager allows to specify your own connection manager for pooling purposes or optimization purposes (warning, this will break the trust insecure behavior)
curl()
   .javaOptions(with().interceptor(((request, responseSupplier) -> {
       LOGGER.info("I log something before the call");
       HttpResponse response = responseSupplier.get();
       LOGGER.info("I log something after the call, status code is {}",
       response.getStatusLine().getStatusCode());
       return response;}))
                      .connectionManager(new PoolingHttpClientConnectionManager ())
                      .placeHolders(asList("fr-FR", "text/html")).build())
   .hUpperCase("'Accept-Language: $curl_placeholder_0'")
   .hUpperCase("'Accept: $curl_placeholder_1'")
   .run("http://www.google.com");

Supported arguments (so far) :

Short Name Long Name Argument Required Description
u username true user:password
cacert cacert true CA_CERT
E cert true CERT[:password]
ct cert-type true PEM,P12,JKS,DER,ENG
compressed compressed false Request compressed response
cti connect-timeout true Maximum time allowed for connection
d data true Data
databinary data-binary true http post binary data
dataurlencode data-urlencode true Data to URLEncode
L location false follow redirects
F form true http multipart post data
H header true Header
X request true Http Method
key key true KEY
kt key-type true PEM,P12,JKS,DER,ENG
m max-time true Maximum time allowed for the transfer
nokeepalive no-keepalive false Disable TCP keepalive on the connection
ntlm ntlm false NTLM auth
o output true write to file
x proxy true use the specified HTTP proxy
U proxy-user true authentication for proxy
1 tlsv1 false use >= TLSv1 (SSL)
tlsv10 tlsv1.0 false use TLSv1.0 (SSL)
tlsv11 tlsv1.1 false use TLSv1.1 (SSL)
tlsv12 tlsv1.2 false use TLSv1.2 (SSL)
2 sslv2 false use SSLv2 (SSL)
3 sslv3 false use SSLv3 (SSL)
k insecure false trust insecure
A user-agent true user agent
V version false get the version of this library
interceptor interceptor true interceptor field or method (syntax is classname::fieldname). Must be a BiFunction<HttpRequest, Supplier< HttpResponse>, HttpResponse> or will be discarded
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].