How to make an HTTP request from Rust using Curl?
To make an HTTP request in Rust using Curl, you can use curl bindings. Stick this in your Cargo.toml[dependencies.curl]
git = "https://github.com/carllerche/curl-rust"
And this in the src/main.rs:
extern crate curl;
use curl::http;
fn main(){
let resp = http::handle()
.post("http://localhost:9988/login", "username=myusername&password=mypassword")
.exec().unwrap();
println!("code={}; headers={}; body={}",
resp.get_code(), resp.get_headers(), resp.get_body());
}