tags:

views:

36

answers:

2

I am a high school student reasonably concerned about my grades, and when I check them through a system known as Zangle! Student Connection, it is mildly painful in how long it takes.

I was wondering if it would be possible to construct a script, in whichever language is deemed appropriate, to login for me, based on a pre-entered login username and password, and then present my grade percentages in a nice layout, instead of the kind of awkward and messy layout it is now presented in.

I'm guessing this either way to hard, or way out of my reach at the moment, or even impossible, but I just thought it was a decently cool idea and was looking for any suggestions.

Also, I have no idea as to which language is best for this, so I would definitely need help on this!

+2  A: 

You could try Greasemonkey, it lets you create "user scripts" in Firefox. That way you could use Javascript to reorganise the interface.

Jivlain
+1  A: 

Well, here is my take on it in PHP, utilizing the cURL library:

PHP is by no means deemed appropriate for the task. It is however, fairly easy to setup what you're looking for in the language.

<?php
error_reporting(-1);

$ch = curl_init();
/*Some sites block your access if you do not have cookies enabled. In order to get the cookies you will need to submit the form manually and using a packet sniffer (or Firebug) get the cookies that are being sent.*/
//$cookies ="CFID=25318504; CFTOKEN=38400766; PERSON_ID=3461047"; 

/*Again, if you have Firebug then getting the following POST data, once you submit the form manually, fairly straightforward. This is what cURL will utilize in the POST fields*/
 //The action=submit may also vary, this is also easily acceible via Firebug. (right next to the parameters tab.   
$post_data = "username=test&password=test&action=submit";



curl_setopt($ch, CURLOPT_URL, "http://www.sitename.com");
//follows a Location: redirect
curl_setopt($ch, CURLOPT_AUTOREFERER, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
//send above cookies, which were gathered manually =(
//Utilize this only if cookies are a neccesity.
//curl_setopt($ch, CURLOPT_COOKIE, $cookies);
//Doing a POST request
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
$output = curl_exec($ch);

curl_close($ch);
if($output == false) {
    echo "cURL Error:" . curl_error($ch);
}
//You can sort this data using an HTML parser
echo $output;

Once you have successfully connected to the site, you can utilize one of many PHP HTML parsers to traverse through the data, such as: DOMDocument and Xpath or SimpleXML.

Russell Dias
Hey, cool! Thanks for this! I'm definitely checking this out! Thanks a lot!!
BOSS