c语言 Linux CURL发送Http get请求 带参数
我要请求的是
http://fs.ccic365.com/ccic-fs/IOT/updateData.shtml?sn=111111111&dataTime=2019-01-24 10:45:04&dataList=["1_1_25.44;25.00;21.32;134","2_1_8.51","3_1_6","4_1_85.44;25.00","5_1_8.52","6_1_8.53;34","7_1_8.54;16.33;33;22","8_1_8.55"]
转义后
http://fs.ccic365.com/ccic-fs/IOT/updateData.shtml?sn=111111111&dataTime=2019-01-24%2010:45:04&dataList=[%221_1_25.44;25.00;21.32;134%22,%222_1_8.51%22,%223_1_6%22,%224_1_85.44;25.00%22,%225_1_8.52%22,%226_1_8.53;34%22,%227_1_8.54;16.33;33;22%22,%228_1_8.55%22]
/**************************************************************************** _ _ ____ _* Project ___| | | | _ \| |* / __| | | | |_) | |* | (__| |_| | _ <| |___* \___|\___/|_| \_\_____|** Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.** This software is licensed as described in the file COPYING, which* you should have received as part of this distribution. The terms* are also available at https://curl.haxx.se/docs/copyright.html.** You may opt to use, copy, modify, merge, publish, distribute and/or sell* copies of the Software, and permit persons to whom the Software is* furnished to do so, under the terms of the COPYING file.** This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY* KIND, either express or implied.****************************************************************************/
/* <DESC>* Use getinfo to get content-type after completed transfer.* </DESC>*/
#include <stdio.h>
#include <curl/curl.h>int main(void)
{CURL *curl;CURLcode res;curl = curl_easy_init();if(curl) {curl_easy_setopt(curl, CURLOPT_URL, "http://fs.ccic365.com/ccic-fs/IOT/updateData.shtml?sn=111111111&dataTime=2019-01-24%2010:45:04&dataList=[%221_1_25.44;25.00;21.32;134%22,%222_1_8.51%22,%223_1_6%22,%224_1_85.44;25.00%22,%225_1_8.52%22,%226_1_8.53;34%22,%227_1_8.54;16.33;33;22%22,%228_1_8.55%22]");res = curl_easy_perform(curl);if(CURLE_OK == res) {char *ct;/* ask for the content-type */res = curl_easy_getinfo(curl, CURLINFO_CONTENT_TYPE, &ct);if((CURLE_OK == res) && ct)printf("We received Content-Type: %s\n", ct);}/* always cleanup */curl_easy_cleanup(curl);}return 0;
}
返回正确:
lgl@lgl-virtual-machine:~/Desktop/hello$ ./out
{"数据分析":["主副设备编号:111111111","采集时间:2019-01-24 10:45:04","空气温度:25.44℃","空气湿度:25.00%","二氧化碳浓度:21.32ppm","大气压:134pa","风速:8.51m/s","风向:6","土壤温度:85.44℃","土壤湿度:25.00%","盐分:8.52%","pm2.5:8.53μg/m3","pm10:34μg/m3","当前雨量:8.54ml","昨日雨量:16.33ml","瞬时雨量:33ml","累积雨量:22ml","光照传感器:8.55KLUX"],"status":"1"}We received Content-Type: application/json;charset=UTF-8
c语言 Linux CURL发送Http get请求 带参数相关推荐
- 用php批处理图片,PHP中使用CURL发送get/post请求上传图片批处理功能
cURL是利用url语法规定传输文件和数据的工具.php中有curl拓展,一般用来实现网络抓取,模拟发送get post请求,文件上传. 在php中建立curl的基本步骤如下: 1.初始化 2. ...
- php curl post上传图片,PHP中使用CURL发送get/post请求上传图片批处理功能
cURL是利用url语法规定传输文件和数据的工具.php中有curl拓展,一般用来实现网络抓取,模拟发送get post请求,文件上传. 在php中建立curl的基本步骤如下: 1.初始化 2. ...
- 使用httpclient进行 Http get请求带参数cookie
使用httpclient进行 Http get请求带参数cookie 常用的工具类,所有的包配置如下 <!--解析json使用--><dependency><groupI ...
- requests之get请求带参数示例详解
具体见以下详细步骤 获取响应数据 获取请求头 获取响应头.状态码 有两点需要引起注意: a.响应结果一般有三种格式:HTML.json.text b.text方法返回的是字符串格式的内容 获取cook ...
- HttpClient ||GET请求||带参数的GET请求
HttpClient 网络爬虫就是用程序帮助我们访问网络上的资源,我们一直以来都是使用HTTP协议访问互联网的网页,网络爬虫需要编写程序,在这里使用同样的HTTP协议访问网页. 这里使用Java的HT ...
- HttpClient Get请求带参数
/** HttpClient Get请求带参数*/@Testpublic void fun1() throws ClientProtocolException, IOException {// 1.创 ...
- php 中使用cURL发送get/post请求,上传图片,批处理
https://mp.weixin.qq.com/s/8luqMEd8xt8oJxFLLCU1XA 文章正文 cURL是利用url语法规定传输文件和数据的工具.php中有curl拓展,一般用来实现网络 ...
- python get请求带参数_python_request的安装及模拟json的post请求及带参数的get请求
一.Requests模块安装 安装方式一: 执行 pip install -U requests 联网安装requests 安装方式二: 进入https://pypi.org/project/requ ...
- POST请求||带参数的POST请求
POST请求 HttpPostTest.java package cn.itcast.crawler.test;import org.apache.http.client.methods.Closea ...
最新文章
- 经典回顾 | 人脸照片秒变艺术肖像画:清华大学提出APDrawingGAN CVPR 2019 oral paper...
- Java五道输出易错题解析(进来挑战下)
- matlab矩阵初等变换矩阵,实验一 MATLAB基本操作及矩阵初等运算
- 长能耐了?想造反了?你老婆没了.......
- vue v html安全,vue 中控制v-html 中的样式,但不影响全局的小技巧
- 【PAT - 甲级1009】Product of Polynomials (25分)(模拟,细节)
- linux mysql 性能提高,高手心得:提高MySQL性能的方法
- 芯片测试探针卡_测试接口业者先受惠苹果A14 GPU双雄4Q再加Socket、探针卡急单
- 一加Nord或在国内上市:骁龙765G+90Hz双孔OLED屏
- mysql主码列允许null_mysql的一些基本操作
- 对称加密、非对称加密、RSA、消息摘要、数字签名、数字证书与 HTTPS 简介
- 适时突破[我眼中的戴尔转型]
- C语言简单通讯录模板
- 很无聊但是又很重要的 计算机网络基础知识 ---“互联网协议“
- 两台局域网电脑共享文件及传输文件集锦
- linux 虚拟启动失败,kvm虚拟机启动失败
- kubuntu我显示服务器,还是不行!kubuntu到底怎么配置IP才能上网啊?[已经解决!]...
- 1260Completed String
- 数字逻辑·逻辑代数【常用公式、化简】
- flutter仿ReadHub+