Web-page in Text-console.

Hi all,
Give me,
How I be see the contents of web-pages in the console? Do not use the GUI.
At least the HTML code.

Example:
Code:
# cat www.freebsd.org

It is must be my console:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>The FreeBSD Project</title>
....
....
</div>
</body>
</html>

What can I be used in lieu of the command "cat"?
 
Install www/p5-libwww:

$ GET [url]http://www.freebsd.org[/url]

Or, if you don't want to install anything, use nc(1) aka "netcat"

Code:
$ nc www.freebsd.org 80
GET / HTTP/1.1
Host: www.freebsd.org
 
www/lynx.
- I'm surprised - it's a text browser. Super.

nc
- Do not work, why? - I will read books.

Code:
# GET [url]http://www.freebsd.org[/url]
- Worked! Thank you.

Thank all very much.
 
Originally Posted by wblock.
What is the application? Is this homework?

No.
I learn FreeBSD for themselves. I recently removed Windows XP.
I like the idea of working in the console - no windows (GUI).
I loved the editor "vi". :)


View HTML code of pages I need - I have been doing web-programming (my tools: Apache 2.0 + mod_wsg 3.3 + Python 3.2 in Win Xp).
On this occasion, talk in the section "Development / Userland Programming & Scripting". - If I can not do it yourself.

Thank you all, again.
 
Use "elinks" much more complicated than "lynx" - but the program stronger.
It's not about "GET", "curl" and "fetch". The beauty of "less".
Code:
# man less

"less" - easily view the contents (hjkl - navigator).
Ok. Thank all very much.
 
doorways said:
nc
- Do not work, why? - I will read books.
After you have made a connection with a webserver you will have to type in this:
Code:
GET / HTTP/1.1
Host: www.freebsd.org
Followed by an empty line. This is a simple, standard HTTP 1.1 request. It's what a browser does to get to the webpage. Netcat is just a really simple connection tool but it has many interesting uses ;)
 
If you are really set on only using the console there are some text-based browsers that can display images. Definitely www/w3m can and there are a few others. http://www.freebsd.org/ports is a web interface to ports.

I can relate to wanting to keep things simple, but the browsing experience you will get with a text-based browser will be quite different than what most page developers intend. You could try x11/xorg with a light window manager (http://forums.freebsd.org/showthread.php?t=21319) and a light browser (http://forums.freebsd.org/showthread.php?t=25331). You could still use your favourite tools (vi/vim) from within Xorg. But, maybe you've already tried this and have your reasons for sticking to the console.

I apologize if some of these straightforward concepts are already clear to you; it's difficult to gauge someone's experience level. I mention them because you said you are coming from XP and perhaps are new to unix-like operating systems like FreeBSD.

Good luck!
 
SirDice said:
After you have made a connection with a webserver you will have to type in this:
Code:
GET / HTTP/1.1
Host: www.freebsd.org
Followed by an empty line. This is a simple, standard HTTP 1.1 request. It's what a browser does to get to the webpage. Netcat is just a really simple connection tool but it has many interesting uses ;)

For some reason, some sites, including http://www.freebsd.org, don't reply with the page. Substitute telnet for nc and it works fine.
 
For SirDice:

Sorry, I did not realize that it was necessary to introduce it:

Code:
# nc www.freebsd.org 80
GET / HTTP/1.1

I thought that the second line is part of the response from the server.
While I know that this HTTP request.
Thank you. (for persistence).



For mingrone:

Actually display a full page (images, background, js, flash) - little interest to me.
For all this, I put the GNOME and FireFox.
Extract from the file /etc/rc.conf
Code:
…
# GUI.
hald_enable=”YES”
dbus_enable=”YES”

gdm_lang=”ru_RU.KOI8-R”
#gnome_enable=”YES”
# end GUI sector.
…

If I want to relax, I run GNOME:
Code:
# /usr/local/etc/rc.d/gdm forcestart

But:
Code:
# whereis w3m
/usr/ports/japanese/w3m

# cd /usr/ports/japanese/w3m
make && make install clean

# w3m  http://www.freebsd.org
Very well browser. Thanks.
In my opinion. He combined in himself as a highlight links "lynx" and power "elinks".

Originally Posted by mingrone.
I apologize if some of these straightforward concepts are already clear to you; it's difficult to gauge someone's experience level. I mention them because you said you are coming from XP and perhaps are new to unix-like operating systems like FreeBSD.

Good luck!

- no, no. I do not know much FreeBSD. Thanks for the details.

----------------------------------------------------------------------------------------------------------------------------------
Thank you all. I learned what I needed.
 
The reason to use a text based browser is that some machines you can't allow x11 on and some of the programs like links or lynx may be scriptable which should help in some edge case administration or data mining. I'm digging all the stuff with REST( Representational State Transfer) with nc(). Definitely going to experiment myself to see that.
 
Back
Top