Example #1
0
 // get url link
 if (strlen(trim($_GET['url'])) > 2048) {
     echo "Error URL is too large !!";
 } else {
     $url = trim($_GET['url']);
     if (!Utils::isValidMd5($url)) {
         // decode it
         $url = html_entity_decode($url);
         // if url use https protocol change it to http
         if (!preg_match('!^https?://!i', $url)) {
             $url = 'http://' . $url;
         }
     }
     $article = new Article();
     $article->setUrl($url);
     if (!$article->isAlreadyExists()) {
         if ($article->retrieveContent()) {
             if ($article->readiIt(isset($_GET['debug']))) {
                 $article->modifyContent();
                 $article->saveContent();
             }
         }
     } else {
         $article = Article::getArticle($url);
         // only for debug
         if ($article->readiIt(isset($_GET['debug']))) {
             $article->modifyContent();
             $article->saveContent();
         }
     }
     if ($article && $article->isLoaded()) {