
03/11/2012, 15:42
|
| | Fecha de Ingreso: julio-2010
Mensajes: 127
Antigüedad: 14 años, 8 meses Puntos: 2 | |
Respuesta: Como autopostear videos de Youtube Puedes hacer tu propio sistema... encontre esto en internet es un sistema espero que te sirva: Cita: <?php
/* Todo esto se puede poner en un require :D */
class RssReader {
var $url;
var $data;
function RssReader ($url){
$this->url;
$this->data = implode ("", file ($url));
}
function get_items (){
preg_match_all ("/<item .*>.*<\/item>/xsmUi", $this->data, $matches);
$items = array ();
foreach ($matches[0] as $match){
$items[] = new RssItem ($match);
}
return $items;
}
}
class RssItem {
var $title, $url, $description;
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];
preg_match ("/<description> (.*) <\/description>/xsmUi", $xml, $matches);
$this->description = $matches[1];
}
function get_title (){
return iconv('UTF-8', 'ISO-8859-1', $this->title);
}
function get_url (){
return iconv('UTF-8', 'ISO-8859-1', $this->url);
}
function get_description (){
return iconv('UTF-8', 'ISO-8859-1', $this->description);
}
}
//Ejemplo de como usarlo
$rss = new RssReader ("http://gdata.youtube.com/feeds/base/users/MICANAL/uploads");
foreach ($rss->get_items () as $item){
printf ('<a href="%s">%s</a><br />%s<br /><br />',
html_entity_decode($item->get_url ()),
html_entity_decode($item->get_description ()),
html_entity_decode($item->get_title ()));
}
?> |