使用boost :: asio发送HTTP GET请求,类似于cURL [英] Sending http GET request using boost::asio, similar to cURL
问题描述
我正在尝试使用某个域的REST API发送http GET请求. 基本上我想做的是替换以下curl请求:
I'm trying to send a http GET request using the REST API of some domain. Basically what I'm trying to do is to replace following curl request:
curl -k -H "Content-Type: application/json" -X GET
--data '{"username":"user@name.co", "password":"test"}' https:/domain.name/api/login/
以及一些使用boost::asio
的c ++代码.
我没有在这里找到所有c ++代码的东西,但是一些检查点会很棒.
with some c++ code using boost::asio
.
I do not what to find all c++ code here , but some checkpoints would be great.
推荐答案
boost::asio
不是应用程序级库.因此,您可以与其建立连接,进行SSL握手等.但是您不能通过boost::asio
构造HTTP请求,因为它仅用于发送/接收数据.
boost::asio
is not an application level library. So you can open a connection with it, do an SSL handshake and so on. But you cannot construct HTTP requests via boost::asio
since it's designed to just send/receive data.
But, you can try to experiment with this asio HTTP client example. Probably this can be a good thing to start with.
这篇关于使用boost :: asio发送HTTP GET请求,类似于cURL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!