Advertisement
achshar

Untitled

May 12th, 2013
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.96 KB | None | 0 0
  1. <?php
  2.  
  3.     $feed_url="http://www.ezrss.it/feed/";
  4.     $feed = simplexml_load_file($feed_url);
  5.  
  6.     include_once('includes/connection.php');
  7.     include_once('includes/article.php');
  8.  
  9.     $article = new Article;
  10.     $articles = $article->fetch_all();
  11.  
  12.     if(!function_exists('debug')) {
  13.         function debug() {
  14.             foreach(func_get_args() as $argument) {
  15.                 echo '<pre>';
  16.                 if(is_array($argument) || is_object($argument)) print_r($argument);
  17.                 else echo htmlentities($argument, ENT_QUOTES);
  18.                 echo '</pre>';
  19.             }
  20.         }
  21.     }
  22.  
  23.     $query = $pdo->prepare("SELECT article_title FROM articles ORDER BY article_id DESC LIMIT 1");
  24.                
  25.     $query->execute();
  26.     $title = $query->fetchColumn();
  27.     $array = array();
  28.  
  29.     foreach($feed->channel as $item) {
  30.         foreach($item->item as $info) {$array[] = array((string) $info->title, (string) $info->link);}
  31.     }
  32.    
  33.     $add = false;
  34.     foreach(array_reverse($array) as $key => $value) {
  35.         debug($key, $add);
  36.         if($value[0] == $title) $add = true;
  37.     }
  38. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement