Beispiel #1
0
 public function index()
 {
     //		$yql = YQL::factory();
     $result = Curl::pull('http://query.yahooapis.com/v1/public/yql?q=select%20description%20from%20rss%20where%20url%3D%27http%3A%2F%2Fsam.clark.name%2Frss%2F%27&format=xml');
     $xml = simplexml_load_string($result);
     var_dump($xml);
 }
Beispiel #2
0
 public static function get_xml_entries($url)
 {
     $data = simplexml_load_string(Curl::pull($url));
     $arr = array();
     foreach ($data->channel->item as $item) {
         $arr[] = $item;
     }
     return $arr;
 }
 /**
  * check_for_feed function.
  * 
  * @access public
  * @param string $url
  * @return boolean
  */
 public function check_for_feed($url)
 {
     $query = "select title,href from html where url='" . $url . "' and xpath='//link' and type='application/rss+xml'";
     $q = urlencode($query);
     $url2 = 'http://query.yahooapis.com/v1/public/yql?q=' . $q . '&format=json';
     $data = Curl::pull($url2);
     $data = json_decode($data);
     if (!isset($data->error) && isset($data->query->results)) {
         if (is_array($data->query->results->link)) {
             foreach ($data->query->results->link as $link) {
                 if (isset($link->href) && strstr($link->href, 'http://') != FALSE) {
                     $this->feeds[$link->title] = array("profile" => $url, "feed" => str_replace('&lang', '&lang', $link->href));
                 }
             }
         } else {
             if (isset($data->query->results->link->href) && strstr($data->query->results->link->href, 'http://') != FALSE) {
                 $this->feeds[$data->query->results->link->title] = array("profile" => $url, "feed" => str_replace('&lang', '&lang', $data->query->results->link->href));
             }
         }
         return TRUE;
     } else {
         return FALSE;
     }
 }