用curl命令,post提交带空格的数据
2008-10-16 14:40
337 查看
今天偶然遇到一个情况,我想用curl登入一个网页,无意间发现要post的数据里带空格。比如用户名为"abcdef",密码为"abc def",其中有一个空格,按照我以前的方式提交:
curl -D cookie -d "username=abcdef&password=abc def" http://login.xxx.com/ 提示登入失败。
于是查看curl手册man curl。找到:
于是改用:
curl -D cookie -d "username=abcdef" -d "password=abc efg" http://login.xxx.com/ 这样就能成功登入了。
转载必须包含本声明,保持本文完整,并以超链接形式注明原始作者“redraiment”和主站点上的本文原始地址。
我的Blogger(子清行)
我的Google Sites(子清行)
我的CSDN博客(梦婷轩)
我的百度空间(梦婷轩)
curl -D cookie -d "username=abcdef&password=abc def" http://login.xxx.com/ 提示登入失败。
于是查看curl手册man curl。找到:
d/--data (HTTP) Sends the specified data in a POST request to the HTTP server, in a way that can emulate as if a user has filled in a HTML form and pressed the submit button. Note that the data is sent exactly as specified with no extra processing (with all newlines cut off). The data is expected to be "url-encoded". This will cause curl to pass the data to the server using the content-type applica- tion/x-www-form-urlencoded. Compare to -F/--form. If this option is used more than once on the same command line, the data pieces specified will be merged together with a separating &-letter. Thus, using ’-d name=daniel -d skill=lousy’ would generate a post chunk that looks like ’name=daniel&skill=lousy’.
于是改用:
curl -D cookie -d "username=abcdef" -d "password=abc efg" http://login.xxx.com/ 这样就能成功登入了。
版权声明
本人的所有原创文章皆保留版权,请尊重原创作品。转载必须包含本声明,保持本文完整,并以超链接形式注明原始作者“redraiment”和主站点上的本文原始地址。
联系方式
我的邮箱,欢迎来信(redraiment@gmail.com)我的Blogger(子清行)
我的Google Sites(子清行)
我的CSDN博客(梦婷轩)
我的百度空间(梦婷轩)
相关文章推荐
- php的curl函数模拟post、get数据提交,速度非常慢的处理办法
- 使用Curl、socket、file_get_contents三种方法POST提交数据
- 使用Curl、socket、file_get_contents三种方法POST提交数据
- php中使用Curl、socket、file_get_contents三种方法POST提交数据
- PHP模拟POST提交数据并获得返回值之CURL方法(使用PHP extension,然后使用php_curl.dll,很不错)
- cURL模拟POST方法提交XML数据并解析
- PHP中CURL使用POST提交XML数据
- 使用Curl、socket、file_get_contents三种方法POST提交数据
- 使用Curl、socket、file_get_contents三种方法POST提交数据
- php使用CURL模拟GET与POST向微信接口提交及获取数据的方法
- 用curl提交POST数据实例
- 使用curl命令post数据
- 关于在用curl函数post网页数据时,遇上表单提交 type为submit 类型而且没有name和id时可能遇到的问题及其解决方法
- curl模拟post提交数据
- cURL模拟POST方式提交数据
- curl 命令提交post表单
- curl附带cookie post数据提交
- 通过Curl、socket、file_get_contents三种方法使用POST提交数据
- 一个关于curl post提交返回数据的问题1
- CURL POST JSON 数据,在linux平台下命令