Login to CM via cURL

I'm trying to automate the login process so that someone on my site does not have to login themselves to CM. I've been able to successfully retrieve their username and password, I just need to get the cURL to work properly. Using the code below, the page that contains the code is loaded, cookie.txt is written to, but there is no redirect to the correct CM page. What am I doing wrong? Thanks.

$post_data['username'] = $username;
$post_data['password'] = $password;

$post_str = '';
foreach($post_data as $key => $value) {
        $post_str .= $key. '=' .urlencode($value). '&';
}
$post_str = substr ($post_str, 0, -1);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://email.provada.com/login.aspx');

curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_str);

curl_setopt($ch, CURLOPT_COOKIEFILE, '/home/provada1/public_html/campaign-monitor-api/cookie.txt'); 
curl_setopt($ch, CURLOPT_COOKIEJAR, '/home/provada1/public_html/campaign-monitor-api/cookie.txt');

curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt ($ch, CURLOPT_TIMEOUT, 60);
curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6");
$result = curl_exec($ch);
curl_close($ch);

Join 200,000 companies around the world that use Campaign Monitor to run email marketing campaigns that deliver results for their business.

Get started for free
1-888-533-8098