Thursday, December 11, 2008

Test a HTTP request with wget

Few usefull options of the wget command to quickly test the response of a web application.

First

wget http://www.google.com
will save the result send by the server in a file with the samename as the page asked (index.html in the case of www.google.com)


use "-o" option to log the wget operation
wget -o wget.log http://www.google.com
Log you can grep 'HTTP request sent, awaiting response... 200 OK' in a script to simply know if the wget succeed

use "-O" to redirect the result in a specified file
wget -O google.index.txt http://www.google.com

"--post-file" allows you to POST data included in the specified file

wget --post-file=POSTdata.txt http://xxxxxx.yyy

Finally use "-no-check-certificate" option to don't check the server's certificate when connecting with SSL.

wget --no-check-certificate https://xxxxxx.yyy

If you need to go through proxy, just use export command before wget to specify the login, password and url of the proxy.
export http_proxy="http://login:password@proxy.exemple.org:8080"

5 comments:

etnik said...

heu c'est le post juste en dessous, merci , en fait gandi je ne pense pas qu'ils aient déjà mis à jour, donc daily ça passe mais pas you tube et je dois alors passer par un lien externe, merci de te soucier de mon cas désespéré et désespérant lol, tiens je vais mettre tn blog dans me s favoris, si j'ai une question tu m'as l'air de toucher plus que ta bille toi, moi je suis plus un littéraire , je me débrouille mais avec les videos sur dit c'est pas évident, et merci d'être passé également
Philippe

Preinstalled Scripts said...

HI, I am always eager to learn about Http, Thanks for sharing a wonderful information.

Steve said...

Nice feature, I didn't now it existed.

ProxyServerSwitcher said...

Thanks, Wget doing it great..
If your using windows you can try this HTTP Request tool
I'm using it to send http get request and analyze the response.

Anonymous said...

Ola, what's up amigos? :)
Hope to get some assistance from you if I will have some quesitons.
Thanks in advance and good luck! :)