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.