Showing posts with label proxy. Show all posts
Showing posts with label proxy. Show all posts

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"