How to Telnet to different web servers using Linux (Ubunto)
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How to Telnet to different web servers using Linux (Ubunto)
I want to Telnet to a web server from my Linux operating system (Ubunto) e.g. "google.com" and retrieve the index page. Then may be Send a search query via Telnet and see what do i get. I am not sure which add-on i require and what procedure to follow. i am using Ubunto
I want to Telnet to a web server from my Linux operating system (Ubunto) e.g. "google.com" and retrieve the index page. Then may be Send a search query via Telnet and see what do i get. I am not sure which add-on i require
none at all, in theory. You just have to "speak" HTTP. For example, try "telnet www.google.com 80", then you're connected to one of Google's web servers. Now talk:
Code:
GET /search?q=tuna+sandwich HTTP/1.0 <enter>
Host: www.google.com <enter><enter>
After the double enter, the server should reply with a bunch of HTTP header lines, the first of which would be:
Code:
HTTP/1.x 200 OK
After the first blank line, the actual response data starts, which should be an HTML document here.
As I said: In theory.
In practise, Google is a bad example, because they require some more HTTP header lines in the request - AFAIK the most important one is a User-Agent that looks like a real browser. But you may try that with some other plain vanilla HTTP server. That's just the way HTTP works.
Quote:
Originally Posted by hshah
i am using Ubunto
Please note: That popular distribution is called Ubuntu (with a 'u' at the end).
Why not use a text web browser like lynx?Kind regards
there had to be that answer sooner or later! ;-)
If it makes sense depends on what hshah really wants. If he's into lightweight, quick retrieval of online information without being annoyed by all the bells and whistles like ads and pseudo-friendly gimmicks, your suggestion is probably a good one. However, in that case he could just as well take a popular and widespread browser like Firefox or Opera and disable Javascript, CSS and display of images.
I thought that the OP might rather be interested in what browser and server are talking behind the scenes, and that would remain hidden with Lynx as well - or can you build arbitrary requests and view all HTTP response headers with Lynx? Probably not.
It's never obvious whether questions like this are demonstrating some undeveloped enlightenment, or full naivete. I like to take the optimistic approach, and assume there is some well-reasoned basis for the question. On that basis, I will suggest creating an HTTP client in a scripting language, such as Perl. This is easily done with the example code in the lib-www-perl module on CPAN. Even if the OP doesn't elect to write anything in Perl, there is enough information about the underlying mechanisms there to contribute to a successful venture using telnet.
--- rod.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.