Хабр Курсы для всех
РЕКЛАМА
Практикум, Хекслет, SkyPro, авторские курсы — собрали всех и попросили скидки. Осталось выбрать!
require_once 'gacData.php';
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_AuthSub');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Calendar');
function createEvent ($client, $title = 'Tennis with Beth',
$desc='', $where = 'On the courts',
$startDate = '', $startTime = '',
$endDate = '', $endTime = '', $tzOffset = '+03')
{
if (!$desc) $desc = $title;
$now = time();
//echo 'time 1: '.date('Y-m-d H:i',$now+60*10).'
';
//echo 'time 2: '.date('H:i',$now+60*10).'
';
if (!$startDate) $startDate = date('Y-m-d',$now+60*10);
if (!$startTime) $startTime = date('H:i',$now+60*10);
if (!$endDate) $endDate = date('Y-m-d',$now+60*10+60);
if (!$endTime) $endTime = date('H:i',$now+60*10+60);
//echo $startDate.' '.$startTime.'
';
$gc = new Zend_Gdata_Calendar($client);
$newEntry = $gc->newEventEntry();
$newEntry->title = $gc->newTitle(trim($title));
$newEntry->where = array();//array($gc->newWhere(''));
$newEntry->content = $gc->newContent($desc);
$newEntry->content->type = 'text';
$when = $gc->newWhen();
$when->startTime = "{$startDate}T{$startTime}:00.000{$tzOffset}:00";
$when->endTime = "{$endDate}T{$endTime}:00.000{$tzOffset}:00";
//var_dump(array($when));
$newEntry->when = array($when);
$times = $newEntry->when;
foreach ($times as $when) {
$reminder = $gc->newReminder();
$reminder->setMinutes('5');
$reminder->setMethod('sms');
$when->reminders = array($reminder);
}
$createdEntry = $gc->insertEvent($newEntry);
return $createdEntry->id->text;
}
function mtime()
{
$now=explode(" ",microtime());
return (float)$now[0] + (float)$now[1];
}
foreach($authData as $authClient){
$start_exec = mtime();
echo $adsense_stat = get_adsense($authClient['adsenseLogin'],$authClient['adsensePassword']);
$adsense_stat_time = mtime();
$client = Zend_Gdata_ClientLogin::getHttpClient($authClient['calendarLogin'], $authClient['calendarPassword'],
Zend_Gdata_Calendar::AUTH_SERVICE_NAME);
echo $eventID = createEvent($client,'Yesterday revenue: $'.$adsense_stat);
$GC_time = mtime();
echo «GC Event created: +».round($GC_time-$adsense_stat_time,4).".
";
echo 'Full time: '.round($GC_time-$start_exec,4).'.';
}
?>
Отправка СМС скриптом, кто-нть знает как и где?