In an expression of experimentation and irony, I'm am trying to write a script that logs into mint.com and downloads my transaction list. I cannot seem to figure out how it works. I've tried a curl script and well as a stream but neither have worked. My curl script looked like this:
Code: Select all
<?php
// INIT CURL
$ch = curl_init();
// SET URL FOR THE POST FORM LOGIN
curl_setopt($ch, CURLOPT_URL, 'https://wwws.mint.com/loginUserSubmit.xevent');
// ENABLE HTTP POST
curl_setopt ($ch, CURLOPT_POST, 1);
// SET POST PARAMETERS : FORM VALUES FOR EACH FIELD
curl_setopt ($ch, CURLOPT_POSTFIELDS, 'username=[USERNAME]&password=[PASSWORD]&task=L');
// IMITATE CLASSIC BROWSER'S BEHAVIOUR : HANDLE COOKIES
curl_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)
$saved = curl_exec ($ch);
if(!$saved)
{
echo "Error: " . curl_error($ch);
}
// SET FILE TO DOWNLOAD
curl_setopt($ch, CURLOPT_URL, 'https://wwws.mint.com/transactionDownload.event?');
// EXECUTE 2nd REQUEST (FILE DOWNLOAD)
$content = curl_exec ($ch);
// CLOSE CURL
curl_close ($ch);
echo $content;
?>
Does anyone see any problems with it or can give me any pointers to getting it to work?