Showing posts with label tips_tricks. Show all posts
Showing posts with label tips_tricks. Show all posts

Friday, October 14, 2011

redirect wget output to stdout



The following command runs wget and sends the output to STDOUT instead of save to a file. Sometimes it useful for testing a URL's output.
wget -q -O - http://www.example.com/file.html

-q  - Turn off Wget's output. (don't print  http-headers ans wget information)
-O - Output file .  If - is used as file, documents will be printed to  standard output, disabling link conversion

Thursday, October 13, 2011

Http request with telnet

How to do http request with telnet command: for testing www server or other reasons.
it's very simple, fo example


# telnet www.server.com 80GET / HTTP/1.0
 

don't forget twice  press enter (new line) after type "GET / HTTP/1.0"


or you can use HTTP 1.1 protocol,
# telnet www.server.com 80GET / HTTP/1.1
Host: www.server.com
 


or if you want to see only http-headers in response type HEAD instend of GET

# telnet www.server.com 80HEAD / HTTP/1.1
Host: www.server.com
 

also you can define other argument with HTTP 1.1 protocol, for example Referer, User-Agetn etc