Autor
|
Tema: Problema RSS Facebook (Leído 2,449 veces)
|
|
|
.:UND3R:.
|
Claro que funciona perfectamente, quizás me expresé mal, cuando lo paso al RSS Reader este no me acepta los &, por ende los cambié por &: y ahí no me funciona :S
|
|
|
En línea
|
Solicitudes de crack, keygen, serial solo a través de mensajes privados (PM)
|
|
|
~ Yoya ~
Wiki
Desconectado
Mensajes: 1.125
|
El problema es con el parse entonce, una buena idea es la de dimitrix, acortar la URL. También puedes ocupar este parse xD. index.php <?php require_once('feed.php'); $feed = new FeedComponent(); print_r($feed->parser('https://www.facebook.com/feeds/notifications.php?id=319579974767006&viewer=1074983523&key=AWhjAKL7r9fCfZlH&format=rss20'));
feed.php <?php class FeedComponent { protected $URL = NULL; public function parser($site) { $result = null; //Variable que retornara el Feed ya parseado $this->URL = $site; $source = $this->getSource($this->URL); $xmlSource = new SimpleXMLElement($source, LIBXML_NOCDATA); //Detecta si el Feed es tipo Atom... $result = $this->AtomParser($xmlSource); //Detecta si el Feed es tipo RSS... $result = $this->RssParse($xmlSource); } //Retorno el contenido... return (empty($result)) ? NULL : $result; } //Function para obtener el codigo de fuente de un archivo Feed protected function getSource($site) { $this-> URL = $site; curl_setopt($ch, CURLOPT_USERAGENT , 'Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.125 Safari/533.4'); curl_setopt($ch, CURLOPT_REFERER , 'http://www.google.com'); return $result; } //Metodo para parsear Feed tipo Atom... protected function AtomParser($xmlSource) { $temp; foreach($xmlSource->entry as $arts) { $temp[] = array('titulo' => $arts->title, 'articulo' => $arts->content, 'url' => $arts->link[4]->attributes()->href); } return $temp; } //Metodo para parsear Feed tipo RSS protected function RssParse($xmlSource) { $temp = null; foreach($xmlSource->channel->item as $arts) { $temp[] = array('titulo' => $arts->title, 'articulo' => $arts->children('content', TRUE), 'url' => $arts->{'link'}); } return $temp; } } ?>
|
|
« Última modificación: 3 Junio 2012, 19:38 pm por ~ Yoya ~ »
|
En línea
|
Mi madre me dijo que estoy destinado a ser pobre toda la vida. Engineering is the art of balancing the benefits and drawbacks of any approach.
|
|
|
.:UND3R:.
|
Hola, me muestra el siguiente error: Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in C:\xampp\htdocs\hola\feed.php:13 Stack trace: #0 C:\xampp\htdocs\hola\feed.php(13): SimpleXMLElement->__construct('', 16384) #1 C:\xampp\htdocs\hola\index.php(6): FeedComponent->parser(' https://www.fac...') #2 {main} thrown in C:\xampp\htdocs\hola\feed.php on line 13 Saludos
|
|
|
En línea
|
Solicitudes de crack, keygen, serial solo a través de mensajes privados (PM)
|
|
|
.:UND3R:.
|
Encontré un simple "feed reader", lo he probado y funciona genial, ahora al momento de probarlo con facebook sucede lo mismo, queda en blanco: <?php //$RSS = new LectorRSS ("http://www.tublogenwordpress.com/blog/feed/rss/"); $RSS = new LectorRSS ("https://www.facebook.com/feeds/notifications.php?id=319579974767006&viewer=1074983523&key=AWhjAKL7r9fCfZlH&format=rss20"); class LectorRSS { var $url; var $data; function LectorRSS ($url){ $this->url; } function obtener_items (){ foreach ($matches[0] as $match){ $items[] = new RssItem ($match); } return $items; } } class RssItem { var $title, $url; function RssItem ($xml){ $this->populate ($xml); } function populate ($xml){ preg_match ("/<title> (.*) <\/title>/xsmUi", $xml, $matches); $this->title = $matches[1]; preg_match ("/<link> (.*) <\/link>/xsmUi", $xml, $matches); $this->url = $matches[1]; } function obtener_titulo (){ return $this->title; } function obtener_url (){ return $this->url; } } foreach ($RSS->obtener_items () as $item){ printf ('<a target="_BLANK" href="%s">%s</a><br />', $item->obtener_url (), $item->obtener_titulo ()); } ?>
a ver si me iluminan, saludos
|
|
|
En línea
|
Solicitudes de crack, keygen, serial solo a través de mensajes privados (PM)
|
|
|
|
Mensajes similares |
|
Asunto |
Iniciado por |
Respuestas |
Vistas |
Último mensaje |
|
|
Problema haciendo aplicacion facebook
PHP
|
Facalot
|
0
|
2,745
|
6 Agosto 2010, 12:58 pm
por Facalot
|
|
|
Problema al entrar a facebook
Dudas Generales
|
Garcam
|
5
|
4,995
|
11 Febrero 2011, 20:27 pm
por Darioxhcx
|
|
|
problema con chat y mensajes de facebook
Dudas Generales
|
esmerum
|
1
|
8,104
|
29 Marzo 2011, 06:43 am
por cavidalb
|
|
|
Solución para el problema del nuevo chat de Facebook
Noticias
|
wolfbcn
|
1
|
4,051
|
25 Julio 2011, 22:31 pm
por dato000
|
|
|
Api Facebook problema de conexión
Desarrollo Web
|
scobi
|
1
|
1,690
|
30 Enero 2013, 23:52 pm
por Shell Root
|
|