Linux CURL的安装和使用
2013-03-27 22:38
148 查看
--获得安装包,从网上直接下载或者其他途径,这里直接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"}
相关文章推荐
- Linux CURL的安装和使用
- Linux CURL的安装和使用
- Linux CURL的安装和使用
- Linux CURL的安装和使用
- Linux CURL的安装和使用
- ubuntu 安装使用 Keras 手扎
- asp.net TreeView安装、使用(如何将TreeView打包发布)(带CheckBox选择框的TreeView的初始化,TreeView客户端操作:选择父节点后自动选择所有子节点,子节点选择后自动选择父节点)(TreeView节点精确定位)2005-12-23更新
- Python从2.6升级到2.7,使用pip安装module,报错:No Module named pip.log(转载)
- CocoaPods安装和使用教程
- CocoaPods安装和使用教程 分类: ios技术 ios相关 2015-03-11 21:53 48人阅读 评论(0) 收藏
- CocoaPods 安装和使用教程
- WebStorm安装与使用
- 如何在CentOS 7上安装和使用Docker
- VIM开发C/C++插件cvim的安装及使用
- VS2010 安装使用STLPort
- Sybase的安装、配置及使用(三) Sybase adaptive server配置
- 使用C#代码安装 Windows 服务(不使用InstallUtil)
- s3cmd 安装使用指南
- cURL安装--Cocos Creator项目使用 VS Code 激活脚本编译
- linux 备份和快照 timeshift的安装和使用