Сценарий PHP, чтобы вытащить из событий Facebook с нескольких страницPhp

Кемеровские программисты php общаются здесь
Ответить
Anonymous
 Сценарий PHP, чтобы вытащить из событий Facebook с нескольких страниц

Сообщение Anonymous »

Bonjour ВСЕ, < /p>
В настоящее время приведенный ниже сценарий находится на моем сервере в виде страницы PHP (pull.php). Он читает события со страницы в Facebook с использованием своего идентификатора, например: 12345678, и выводит их в файл, например,: 1234568.ics. < /P>

Что я хотел бы попросить это сообщество, чтобы помочь: < /p>

1). Как будет изменять код ниже, чтобы прочитать многие из Page pages (я должен изменить код. Например: 12345678, 24681357, 12348765) и вывод во многие файлы 12345678.ics, 24682357.ics, 12348765.ics < /p>

2). Идея в том, что я запустим работу Cron, которая запустит этот сценарий ночью. Затем у меня есть плагин на моей странице в Facebook, который обновляет события на веб -сайте на основе канала .ics.$access_token = MY_ACCESS_TOKEN;
$page = "12345678";

// We don't want to query the Facebook Graph API over and over, so we'll cache our results. You can force the cache to update by visiting the script and appending "?f=true", otherwise it will only run (rather than display the cache) if the cache is older than 3600 seconds (one hour).
$cache = $page . ".cache";
$f = false;
if($_GET['f'] == "true"){
$f = true;
}
if(!file_exists($cache) || filemtime($cache) $page));

$c->setProperty('X-WR-CALNAME', $page . ' events');
$c->setProperty('X-WR-CALDESC', 'Facebook events for ' . $page);
$c->setProperty('X-WR-TIMEZONE', $events[0]->timezone); // We assume all of the events use the same timezone.

// Loop through the events, create event components in the calendar
foreach($events as $key => $event){
$e[$key] = & $c->newComponent('vevent');

$e[$key]->setProperty('summary', $event->name);
$e[$key]->setProperty('dtstart', $event->start_time);
$e[$key]->setProperty('dtend', $event->end_time);
if (!isset($event->end_time)) {
$e[$key]->setProperty('dtend', $event->start_time);
}
$e[$key]->setProperty('description', $event->description . "\n\nhttp://www.facebook.com/events/" . $event->id);
$e[$key]->setProperty('location', $event->location);
}

// Remove the cache if it exists
if(file_exists($cache)){
unlink($cache);
}

// Open (create) the cache file
if(!$handle = fopen($cache, 'w')){
echo "Cannot open output file: " . $cache;
exit;
}

// Write the calendar to the cache
if(fwrite($handle, $c->createCalendar()) === FALSE){
echo "Cannot write to output file: " . $cache;
exit;
}

// Close the cache file
fclose($handle);
}

// Now we've got the calendar in the cache file, either newly generated and stored there just a few lines ago or from earlier. Now we'll just display it.

header("Content-Type: text/calendar; charset=UTF-8");
header("Content-Disposition: filename=" . $page . ".ics");
require($cache);
?>
< /code>

Может ли кто -нибудь иметь подсказку, как это сделать? < /p>

Заранее! Впрыгивает, если вы можете мне помочь!

Подробнее здесь: https://stackoverflow.com/questions/229 ... iple-pages
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Php»