我有一个脚本,根据PHP文件中的内容向用户发送推送通知。 这是那个文件......重要的部分......
$doc = new DOMDocument();
$doc->load('RandomXML Url location here ');
$arrFeeds = array();
foreach ($doc->getElementsByTagName('item') as $node) {
$itemRSS = array (
'title' => $node->getElementsByTagName('title')->item(0)->nodeValue,
'desc' => $node->getElementsByTagName('description')->item(0)->nodeValue,
'link' => $node->getElementsByTagName('link')->item(0)->nodeValue,
'date' => $node->getElementsByTagName('pubDate')->item(0)->nodeValue
);
array_push($arrFeeds, $itemRSS);
}
// APPLE APNS EXAMPLE 1
$apns->newMessage(2);
$apns->addMessageAlert($itemRSS['title']);
// $apns->addMessageCustom('acme2', array('bang', 'whiz'));
$apns->queueMessage();
// SEND ALL MESSAGES NOW
$apns->processQueue();
那就是发送通知的PHP。它在加载此PHP脚本时发出通知。
它从Feed中加载第一个帖子并将其发送出去。我想在每次使用新帖子更新RSS源时发送通知。如果使用新的Feed更新,那么我想运行上面的代码。
那我怎么能这样做并确保它经常运行?
我真的很想看看我需要检查哪些代码更新?我不知道如何检查更新,这可能是脚本中最重要的部分。