If you'are lazy people like me. This script may help u. This script is to automated our login to some site. You must have cURL installed to use this script.
<?php// INIT CURL$ch = curl_init();// SET URL FOR THE POST FORM LOGINcurl_setopt($ch, CURLOPT_URL, 'http://http://ww1.external-site.com/rg-erdr.php?_rpo=t ENABLE HTTP POSTcurl_setopt ($ch, CURLOPT_POST, 1);// SET POST PARAMETERS : FORM VALUES FOR EACH FIELDcurl_setopt ($ch, CURLOPT_POSTFIELDS, 'fieldname1=fieldvalue1&fieldname2=fieldvalue2');// IMITATE CLASSIC BROWSER'S BEHAVIOUR : HANDLE COOKIEScurl_setopt ($ch, CURLOPT_COOKIEJAR, 'cookie.txt');# Setting CURLOPT_RETURNTRANSFER variable to 1 will force cURL# not to print out the results of its query.# Instead, it will return the results as a string return value# from curl_exec() instead of the usual true/false.curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);// EXECUTE 1st REQUEST (FORM LOGIN)$store = curl_exec ($ch);// SET FILE TO DOWNLOADcurl_setopt($ch, CURLOPT_URL, 'http://http://ww1.external-site.com/rg-erdr.php?_rpo=t EXECUTE 2nd REQUEST (FILE DOWNLOAD)$content = curl_exec ($ch);// CLOSE CURLcurl_close ($ch); ?>