Consultez la FAQ sur le ZF avant de poster une question
Vous n'êtes pas identifié.
j'ai besoin de contrôler intégrité des sites web. l'utilisateur va devoir donner le lien du site qu'il veut contrôler et son mail pour pouvoir par la suite lui envoyer une notification lorsqu'il y un changement du contenu du site
j'ai commencer à programmer sa pour un seul site et un seul mail et voila le code
public function indexAction() { ignore_user_abort(true); set_time_limit(0); function cURLcheckBasicFunctions() { if (!function_exists("curl_init") && !function_exists("curl_setopt") && !function_exists("curl_exec") && !function_exists("curl_close")) return false; else return true; } /* * Returns string status information. * Can be changed to int or bool return types. */ function cURLdownload($url, $file) { if (!cURLcheckBasicFunctions()) return "UNAVAILABLE: cURL Basic Functions"; $ch = curl_init(); if ($ch) { $fp = fopen($file, "w"); if ($fp) { if (!curl_setopt($ch, CURLOPT_URL, $url)) { fclose($fp); // to match fopen() curl_close($ch); // to match curl_init() return "FAIL: curl_setopt(CURLOPT_URL)"; } if (!curl_setopt($ch, CURLOPT_FILE, $fp)) return "FAIL: curl_setopt(CURLOPT_FILE)"; if (!curl_setopt($ch, CURLOPT_HEADER, 0)) return "FAIL: curl_setopt(CURLOPT_HEADER)"; if (!curl_exec($ch)) return "FAIL: curl_exec()"; curl_close($ch); fclose($fp); return "SUCCESS: $file [$url]"; } else return "FAIL: fopen()"; } else return "FAIL: curl_init()"; } while(true){ /*$LiensModel = new Model_DbTable_Liens(); $liensTbl = $ProjetModel->fetchAll();*/ if(false) { break; } // Download from 'example.com' to 'example.txt' echo cURLdownload("www.kooora.com/default.aspx", "example.php"); //header("refresh: 5 url=index.php"); $file_xls = "example.php"; $file_md5 = "example.php.md5"; // Must exists and must be writable for PHP $md5_new_file = trim(md5_file($file_xls)); $md5_old_file = trim(file_get_contents($file_md5)); if ($md5_new_file <> $md5_old_file) { $m = new ZC_HtmlMailer(); $m->setSubject("Salut!") ->addTo("anisbenameur.ing@gmail.com") ->setViewParam('name', 'Ben Ameur Anis') ->sendHtmlTemplate("hello.phtml"); rename($file_md5, $file_md5 . ".bak"); $fp = fopen($file_md5, 'w'); fwrite($fp, $md5_new_file); fclose($fp); /* Here we do some job... In my case - dealing with "Spreadsheet Excel Reader" */ unlink($file_md5 . ".bak"); } // "Not for crontab" - Remove the following section if you are intending to run it in crontab else { echo "Fichier mis à jour, Aucun Changement Effectuer..."; } sleep(5); } // End "Not for crontab"; }
je veut maintenant faire sa pour plusieurs site svp aidez moi
Hors ligne