# This shell script shows how to access orkut (or any Google service) programmatically using wget version above 1.9.

export http_proxy=iiscproxy1.serc.iisc.ernet.in:3128
export https_proxy=iiscproxy1.serc.iisc.ernet.in:3128
export myurl="http://www.orkut.com/Home.aspx";
export out=out

# login to google.
wget --no-check-certificate --load-cookies=orkutcookies --save-cookies=orkutcookies --keep-session-cookies --post-data="continue=$myurl&followup=$myurl&Email=user@gmail.com&Passwd=password&PersistentCookie=true" --user-agent="Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050517 Firefox/1.0.4 (Debian package 1.0.4-2)" https://www.google.com/accounts/ServiceLoginAuth?service=orkut -t 1 -T 30 -O $out

# url of the profile page.
export myurl="http://www.orkut.com/Profile.aspx?uid=8496521925118208406";

# now try to access the required page.
wget -S --no-check-certificate --load-cookies=orkutcookies --save-cookies=orkutcookies --post-data="continue=$myurl&followup=$myurl" --user-agent="Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050517 Firefox/1.0.4 (Debian package 1.0.4-2)" -t 1 -T 30 -O $out $myurl

# parse the redirection url.
export url=`grep "url=" $out | sed "s/.*url='//" | sed "s/'\">.*//" | sed 's/amp;//g' | sed 's/www.google.com/www.google.com/'`

# get redirected url: which is the page we want, i.e. the profile page.
wget -t 1 -T 30 -S --no-check-certificate --load-cookies=orkutcookies --save-cookies=orkutcookies --user-agent="Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050517 Firefox/1.0.4 (Debian package 1.0.4-2)" -O $out "$url"

# the profile page is present in file "out". Enjoy!