I'm trying to connect to a wifi network where it hijacks all requests and redirects you to a page where you have to agree to a terms of use before it lets you connect to the actual outside world. This is a pretty common practice, and usually doesn't pose much of a problem.

However, I've got a computer running Ubuntu 9.10 server with no windowing system. How can I use the command line to agree to the terms of use? I don't have internet access on the computer to download packages via apt-get or anything like that. Sure, I can think of any number of workarounds, but I suspect there's an easy way to use wget or curl or something.

Basically, I need a command line solution for sending an HTTP POST request essentially clicking on a button. For future reference, it'd be helpful to know how to send a POST request with, say, a username and password if I ever find myself in that situation in another hotel or airport.


2 Answers 2


Install Lynx in advance, and then use Lynx from the command line. Lynx is a text based browser.

Alternatively, you can try using wget or curl to get www.google.com and then analyse the HTTP file returned.

  • 7
    links will do a better job than lynx -- it's a slightly more modern browser. (no really. use links. check your local package manager.) Apr 20, 2010 at 4:38
  • +1 links works just great. Really easy to use and does the job just fine. Apr 20, 2010 at 5:29
  • I ended up using this answer this time (downloaded lynx with a separate computer and transferred the file over usb), but it's probably time I actually learn how to use curl.
    – Shane
    Apr 20, 2010 at 16:30

You will have to look once at the source of the login form to find out the names of the user and password fields. As the authentication redirect all pages, use any URL to get that source:

curl http://www.google.com > login.html

For example, you'll find:

<form method="POST" action="http://my-public-provider.com/agree.php">
    <input type="checkbox" name="agree" value="yes">I agree
    <input type="submit" name="push" value="Send">

Another way is to use (on an other computer) a proxy such as Fiddler2 to see what is sent "over the wire" by the browser.

Then you can build your curl command to post your form information:

curl -d "agree=yes&push=Send" http://my-public-provider.com/agree.php

If you do not have curl, it is possible to write a simple HTTP client with a language you may have on the platform (Perl, Lua, Java...).

  • But some web portal is pure javascript based, which means there must be a browser with JS support to access the Internet.
    – TJM
    May 25, 2021 at 7:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .