Herzlich willkommen im Archiv vom ABAKUS Online Marketing Forum
Du befindest Dich im Archiv vom ABAKUS Online Marketing Forum. Hier kannst Du Dich für das Forum mit den aktuellen Beiträgen registrieren.
Code: Alles auswählen
<?php
$google_login = 'dein@login.de';
$pwd = 'deinpasswort';
$user_agent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";
// init curl connection
$total_cash = 0;
$ch = curl_init();
echo htmlHeader();
// GOOGLE
function google($email) {
global $pwd, $google_url, $google_params, $total_cash, $i;
echo '<tr><td><font color="blue">G</font><font color="red">o</font><font color="#cc9900">o</font><font color="blue">g</font><font color="green">l</font><font color="red">e</font> ' . ($i + 1) . '</td><td align="right">';
$google_url = 'https://www.google.com/adsense/login.do';
$google_params = 'username=' . $email . '&password=' . $pwd;
$data = getCurlData($google_url, $google_params);
$google_amount_today = parseGoogleCash($data);
// Google USD-Betrag von GESTERN ermitteln:
$google_url = 'https://www.google.com/adsense/report/aggregate';
$google_params = 'product=afc&dateRange.dateRangeType=simple&dateRange.simpleDate=yesterday&dateRange.customDate.start.day=1&dateRange.customDate.start.month=6&dateRange.customDate.start.year=2005&dateRange.customDate.end.day=1&dateRange.customDate.end.month=6&dateRange.customDate.end.year=2005&unitPref=page&reportType=property&null=Bericht+anzeigen';
$data = getCurlData($google_url, $google_params);
$google_amount_yesterday = parseGoogleCash($data);
// Google USD-Betrag aktueller MONAT ermitteln:
$google_params = 'https://www.google.com/adsense/report/aggregate?product=afc&dateRange.dateRangeType=simple&dateRange.simpleDate=thismonth&dateRange.customDate.start.day=1&dateRange.customDate.start.month=6&dateRange.customDate.start.year=2005&dateRange.customDate.end.day=1&dateRange.customDate.end.month=6&dateRange.customDate.end.year=2005&groupByPref=date&unitPref=page&reportType=property&null=Bericht+anzeigen';
$data = getCurlData($google_url, $google_params);
$google_amount_month = round((parseGoogleCash($data) / 1.24), 2);
$total_cash += $google_amount_month;
echo '' . $google_amount_yesterday . ' ' . $google_amount_month;
echo '</td></tr>';
$i++;
}
google($google_login);
// GOOGLE end
function parseGoogleCash($data) {
preg_match_all("|(.*)<tr class=\"totals\">(.*)USD(.*)<td style=\"text-align:right\" nowrap class=\"\" valign=\"top\"> USD (.*) </td> </tr> <tr class=\"averages\">|U",$data,$result);
$amount = $result[4][0];
if ($amount != "") {
return $amount;
} else {
return "0,00";
}
}
// close curl connection
curl_close($ch);
echo htmlFooter();
// ---- FUNCTIONS ----
function getCurlData($url, $params, $post=1) {
global $ch, $user_agent;
curl_setopt($ch, CURLOPT_POST,$post);
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
// curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_COOKIEJAR, '/tmp/');
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 120);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); // this line makes it work under https
$data=curl_exec($ch);
return $data;
}
function htmlHeader() {
return '<html><head><title>Kontostand</title></head><body><table>';
}
function htmlFooter() {
return '</table></body></html>';
}
function moneyFormat($amount) {
if ($amount != "") {
return round($amount,2);
} else {
return "0,00";
}
}
?>