SSL and cURL to Adult Friend Finder

SSL and cURL to Adult Friend Finder

Cancelled

Job Description

I need someone to finish a script for me. It is a script I wrote that logs into the adult friend finder affiliate site and downloads traffic stats and payout information.

I already have most of the code written but I do not have time to troubleshoot why ssl is not working, make error handeling etc. I will give you the code I have and all you have to do is get curl to login to https://secure.adultfriendfinder.com/p/partners/main.cgi and get the stats xml file. You can use your own account, accounts are free to make.

<?php
session_start();
print "start<br />";
# Log into AFF
$cookiefile = tempnam("/tmp", "cookies");
$agent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";
// https://secure.adultfriendfinder.com/p/partners/main.cgi?
$url = "https://secure.adultfriendfinder.com/p/partners/main.cgi";
$USER = '';
$PASS = '';
$data = 'login_id='.$USER.
'&password='.$PASS.
'&site=ffadult'.
'&action=login'.
'&viewreport=Submit'.
'&who=r,1UPt1MRIZsyY/szJ1AoS2F6Q2XellBj6EPiW13OqG1ohfmlivFeL/iT1CZZA_0b3rD/gcuSPZkdSSlgfDOxVjHaLk8QPlJfO7HITBLgdi52Leug16x7kcVl0AtV2Vp6s';

//Initialise CURL
$ch = curl_init();
//Set all the various options
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt($ch, CURLOPT_REFERER, $url);
curl_setopt($ch, CURLOPT_POST, 1); // set POST method
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt( $ch, CURLOPT_COOKIE, $strCookie);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiefile);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiefile);
#curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
#curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
#curl_setopt($ch, CURLOPT_CAINFO, getcwd() . "/secure.adultfriendfinder.crt");
$curl_result = curl_exec($ch);
if(!$curl_result){
print "Failed:";
print curl_error($ch);
exit();
}

// Change the url now that we have logged in
$url = "https://secure.adultfriendfinder.com/p/partners/main.cgi";
$data = "who=r,1UPt1MRIZsyY/szJ1AoS2F6Q2XellBj6EPiW13OqG1ohfmlivFeL/iT1CZZA_0b3rD/gcuSPZkdSSlgfDOxVjHaLk8QPlJfO7HITBLgdi52Leug16x7kcVl0AtV2Vp6s".
"&site=ffadult".
"&runuserid=".
"&asite=ffadult".
"&apid=$USER-pmo".
"&asession=ffadult:r,nmvqtYCOigyt0pTSWmhMqQGIrWAPbhEL2MFQmKAVkDtKGvdTCusK9AcClTftNQ/dSPuisFCEvLrFVnkDdzzO4A--".
"&action=sub_stats".
"&xml=1".
"&to_pid=$USER-pmo".
"&type=8".
"&startdate=".date('Y-m-d').
"&enddate=".date('Y-m-d').
"&sort_by=uniques".
"&submit=Download XML";
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt($ch, CURLOPT_REFERER, $url);
curl_setopt($ch, CURLOPT_POST, 1); // set POST method
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt( $ch, CURLOPT_COOKIE, $strCookie);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiefile);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiefile);
//execute the CURL call
$curl_result = curl_exec($ch);
curl_close($ch);


print $curl_result;
?>