Canadian TV, Computing and Home Theatre Forums banner

1 - 3 of 3 Posts

·
Registered
Joined
·
2 Posts
Discussion Starter #1
I just got Roger's internet at the beginning of June. I used to have Bell unlimited DSL,but then I moved and the connection here sucks for DSL.
Anyways I was so used to unlimited I was worried about going over my bandwidth usage (I downloaded 1 TB.. yes 1 TB... from Bell during my last 2 months with them... so needless to say I am a bit paranoid about my usage now with only 60 gb)

Anyways I found it a little annoying to have to keep logging into the Roger's page every time I wanted to check my bandwidth, so I wrote a script that will auto log me into Rogers, grab and return my usage.
I currently have it set up to email me every morning what my current usage is.

Anyways here is the bases for the script.
Code:
<?
define('user','username');
define('password', 'password');
define('urlLoginForm', 'https://www.rogers.com/siteminderagent/forms/login.fcc');
define('loginTarget', 'https://www.rogers.com/web/loginSuccess.jsp');
define('urlUsage', 'h://www.rogers.com/web/myrogers/internetUsageBeta');

$query = http_build_query(array(	'USER'	=> user, 'password' => password, 'SMAUTHREASON' => 0, 'TARGET' => loginTarget));


$ch = curl_init();
//set the url, number of POST vars, POST data
curl_setopt($ch, CURLOPT_URL, urlLoginForm);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $query);
curl_setopt($ch, CURLOPT_COOKIESESSION, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION  ,1); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER  ,1);
curl_setopt($ch, CURLOPT_AUTOREFERER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt');
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt'); 
curl_exec($ch);
curl_close($ch);


$ch = curl_init();

curl_setopt($ch,CURLOPT_URL, urlUsage);
curl_setopt($ch, CURLOPT_RETURNTRANSFER  ,1);  
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt');
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt'); 
$usage = curl_exec($ch);
curl_close($ch);

preg_match('/internetUsageUsed = ([\d\.]+)/', $usage, $match);

echo $match[1];
?>
 
1 - 3 of 3 Posts
Top