linux curl操作
来源:互联网 发布:sai中文版mac免费下载 编辑:程序博客网 时间:2024/05/15 05:38
--获得安装包,从网上直接下载或者其他途径,这里直接wget
# wget http://curl.haxx.se/download/curl-7.17.1.tar.gz
--解压到当前目录
# tar -zxf curl-7.17.1.tar.gz
--进入解压后的目录内
# cd curl-7.17.1
--配置,指定安装的目录,这里是“/usr/local/curl”
# ./configure --prefix=/usr/local/curl
--
# make
--安装
# make install
--安装完毕
使用:
将curl命令加入环境变量,
命令行里执行(仅对本会话起作用,或者在.bash_profile、.bashrc文件里配置环境变量):
# export PATH=$PATH:/usr/local/curl/bin
然后就可以使用了
# curl http://www.baidu.com
出来好多html代码,是百度首页的代码
入门的使用说明:
http://www.javaeye.com/topic/648143
-------------------------------------------------------------------------------------------
使用实例(发送POST请求):
# curl -d @json http://www.google.com/loc/json
-d —— 是以POST形式发送请求
@json —— @是从文件中读取数据,json文件中的内容为{"address_language":"zh_CN","cell_towers":[{"cell_id":"36526","location_area_code":"14556","mobile_contry_code":"460","mobile_network_code":"02"}],"host":"maps.google.com","location":null,"request_address":true,"version":"1.1.0","wifi_towers":[]}
返回:
{"location":{"latitude":32.117302,"longitude":114.116598,"address":{"country":"中国","country_code":"CN","region":"河南省","city":"信阳市"},"accuracy":1625.0},"access_token":"2:FaXK0Xl_DHRbcQiK:5tGTJsZx1scpjUfJ"}
# wget http://curl.haxx.se/download/curl-7.17.1.tar.gz
--解压到当前目录
# tar -zxf curl-7.17.1.tar.gz
--进入解压后的目录内
# cd curl-7.17.1
--配置,指定安装的目录,这里是“/usr/local/curl”
# ./configure --prefix=/usr/local/curl
--
# make
--安装
# make install
--安装完毕
使用:
将curl命令加入环境变量,
命令行里执行(仅对本会话起作用,或者在.bash_profile、.bashrc文件里配置环境变量):
# export PATH=$PATH:/usr/local/curl/bin
然后就可以使用了
# curl http://www.baidu.com
出来好多html代码,是百度首页的代码
入门的使用说明:
http://www.javaeye.com/topic/648143
-------------------------------------------------------------------------------------------
使用实例(发送POST请求):
# curl -d @json http://www.google.com/loc/json
-d —— 是以POST形式发送请求
@json —— @是从文件中读取数据,json文件中的内容为{"address_language":"zh_CN","cell_towers":[{"cell_id":"36526","location_area_code":"14556","mobile_contry_code":"460","mobile_network_code":"02"}],"host":"maps.google.com","location":null,"request_address":true,"version":"1.1.0","wifi_towers":[]}
返回:
{"location":{"latitude":32.117302,"longitude":114.116598,"address":{"country":"中国","country_code":"CN","region":"河南省","city":"信阳市"},"accuracy":1625.0},"access_token":"2:FaXK0Xl_DHRbcQiK:5tGTJsZx1scpjUfJ"}
0 0
- linux curl操作
- curl 操作
- Curl操作
- linux CURL
- Linux curl
- linux curl
- linux curl
- [转]curl - linux curl命令
- curl 实用操作
- curl常用操作
- 使用cURL操作Swift
- curl常用操作集锦
- curl 操作github
- curl 异步执行操作
- php之curl操作
- 简单curl操作
- curl相关操作
- curl基本操作
- 关于MFC 用ADO连接SQL中出现_ConnectionPtr 未定义的错误
- HDU 4549 M斐波那契数列(矩阵快速幂)(费马小定理)
- PlaceHolder 兼容性解决方法
- App架构设计经验谈:接口的设计(转载)
- PHP CI框架使用多个数据库
- linux curl操作
- Fragment简单入门
- C++ RGB图片任意角度旋转
- PowerDesigner15连接Oracle11g,反向工程导出模型图
- 用U盘装win7纯净版系统提示缺少所需的CD/DVD驱动器设备驱动程序解决办法
- VC最好不要重写它的init方法
- Spring MVC之@RequestBody, @ResponseBody 详解
- [编写高质量iOS代码的52个有效方法](六)协议与分类
- mongodb各操作的读写锁