niestety skrypt w którym pomógł mi ostatnio Kofel (w tym temacie http://forum.php.pl/index.php?showtopic=211830) nie spełnia swego zadania gdyż kanał rss z którego były pobierane informacje miał duże opóźnienie nawet po 2-3 godziny co jest dla mnie nie do przyjęcia. Na internecie znalazłem taki skrypt:
<?php // Pull in PHP Simple HTML DOM Parser include("simplehtmldom/simple_html_dom.php"); // Settings on top // id is the page ID for selector ); $savePath = "cachedPages/"; $emailContent = ""; // For every page to check... foreach($sitesToCheck as $site) { $url = $site["url"]; // Calculate the cachedPage name, set oldContent = ""; $oldContent = ""; // Get the URL's current page content $html = file_get_html($url); // Find content by querying with a selector, just like a selector engine! foreach($html->find($site["selector"]) as $element) { $currentContent = $element->plaintext; } // If a cached file exists // Retrieve the old content } // If different, notify! if($oldContent && $currentContent != $oldContent) { // Here's where we can do a whoooooooooooooole lotta stuff // We could tweet to an address // We can send a simple email // We can text ourselves // Build simple email content $emailContent = "David, the following page has changed!\n\n".$url."\n\n"; } // Save new content file_put_contents($savePath.$fileName,$currentContent); } // Send the email if there's content! if($emailContent) { // Sendmail! mail("mail@mailnajakimawyslac.com","Sites Have Changed!",$emailContent,"From: alerts@davidwalsh.name","\r\n"); // Debug } ?>
Lecz też nie funkcjonuje. Każdy nagłówek newsa w kodzie jest w
. Na stronie z której pobieram informacje jest 10 newsów lecz otwierając plik w katalogu cachedPages znajduje się tylko nagłówek najstarszego, jednego news'a. Nawet ten jeden nagłówek nie wysyła na maila. W czym problem ?
Z góry dziękuję za pomoc.