简体   繁体   English

命令行网页浏览

[英]command line web browsing

Is there a way to perform http commands GET/PUT/SET whatever via a command line in ubuntu or windows xp? 有没有办法通过ubuntu或windows xp中的命令行执行http命令GET / PUT / SET? Preferably without installing 3rd party products. 最好不要安装第三方产品。 Being that http is text based I thought it would be alot easier to run in the cmd line. 由于http是基于文本的,我认为在cmd行中运行会更容易。

I've been able to get what I want out of GET in ubuntu in bash via 我已经能够在bash中通过ubuntu得到我想要的GET

$wget google.com
$cat index.html

This is kinda clunky. 这有点笨重。 It would be nice to pipe the output or something, but even that isn't straight forward. 管道输出或其他东西会很好,但即使这样也不是直截了当的。 C programs are fine too. C程序也很好。 I'm trying to do something like what we get with Fiddler, but more basic. 我正在尝试做一些像Fiddler那样的东西,但更基本的东西。

telnet google.com 80
GET / HTTP/1.0
Host: google.com

You have to hit return twice after the Host line. 你必须在主机线后两次点击返回。 It doesn't get any more basic. 它没有任何更基本的。

If you are familiar with HTTP use telnet . 如果您熟悉HTTP使用telnet

If you are looking for a browser take a look for Links . 如果您正在寻找浏览器,请查看链接

Although it requires a 3rd party tool, these days I use curl . 虽然它需要第三方工具,但这些天我使用curl The -X option allows me to specify the HTTP verb. -X选项允许我指定HTTP谓词。 Windows has a few bash clients that allow you to run curl including Cygwin . Windows有一些bash客户端允许你运行curl,包括Cygwin

Sample Execution 样品执行

$ curl -H "Content-Type: application/json" -X POST -d '{value: "600"}' http://localhost:8888/my/endpoint

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM