elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: AIO elhacker.NET 2021 Compilación herramientas análisis y desinfección malware


+  Foro de elhacker.net
|-+  Programación
| |-+  Desarrollo Web
| | |-+  PHP (Moderador: #!drvy)
| | | |-+  XML, RSS
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: XML, RSS  (Leído 2,440 veces)
Crack_X
Anti-War
Ex-Staff
*
Desconectado Desconectado

Mensajes: 2.322


Peace & Love


Ver Perfil WWW
XML, RSS
« en: 5 Junio 2007, 23:15 pm »

Hay alguna clase para parsear xml y un pequeno ejemplo? estuve buscando y encontre una en php.net pero no estoy seguro si viene incluido en todos los php o hay que instalarlo adicionalmente.

Saludos,
Crack_X


En línea

Shit loads of money spend to show us wrong from right. Say no to war


Yasser Has Things To Say
WarZone
alone-in-the-chat


Desconectado Desconectado

Mensajes: 587


Ver Perfil
Re: XML, RSS
« Respuesta #1 en: 5 Junio 2007, 23:59 pm »




http://foro.elhacker.net/index.php/topic,155881.0.html


Si me acordaba haber puesto una
n_n

Saludos.


En línea

Because maybe
You're gonna be the one that saves me
And after all
You're my wonderwall
d[n_n]b
Crack_X
Anti-War
Ex-Staff
*
Desconectado Desconectado

Mensajes: 2.322


Peace & Love


Ver Perfil WWW
Re: XML, RSS
« Respuesta #2 en: 9 Junio 2007, 06:44 am »

Volviendo con el tema... estoy intentando esto:

Código:
	<?php	

$xml = file_get_contents('feed.xml');


// Callback functions from reader
// ==============================

$flag = array();
$g = "";
function elementStart($parser, $tag, $attributes) {

echo "STARTED tag " . $tag . "<br/>";
$flag[$tag] = "";
$g = $tag;
}

function elementEnd($parser, $tag) {

echo "Ended tag " . $tag . "<br/>";


}

function cdata($parser, $data) {

echo "Data " . $data . "<br/>";
$flag[$g] = $data;
}

$parser = xml_parser_create();

// Setup end/start handlers
xml_set_element_handler($parser,"elementStart","elementEnd");

// Ok we need to handle character data
xml_set_character_data_handler($parser,"cdata");
xml_parse($parser, $xml);
xml_parser_free($parser);

echo $flag["TITLE"] . "TEST";
?>

Pero no sale nada en $flag["TITLE"] y si existe un tag llamado title. Alguna sugerencia de como hacerlo?
En línea

Shit loads of money spend to show us wrong from right. Say no to war


Yasser Has Things To Say
WarZone
sirdarckcat
Aspirante a supervillano
Colaborador
***
Desconectado Desconectado

Mensajes: 7.029


No estoy loco, soy mentalmente divergente


Ver Perfil WWW
Re: XML, RSS
« Respuesta #3 en: 9 Junio 2007, 08:58 am »

usa preg_match xD
hice un parser sencillo para el bot de me****, y si quieres las expresiones regulares, en warzone, ve el codigo de reporter.js

sin embargo, si quieres usar las funciones nativas de php, son estas.. www.php.net/xml
es necesario que pongas aqui que feed.xml estas usando :P

Saludos!!
En línea

Crack_X
Anti-War
Ex-Staff
*
Desconectado Desconectado

Mensajes: 2.322


Peace & Love


Ver Perfil WWW
Re: XML, RSS
« Respuesta #4 en: 9 Junio 2007, 21:03 pm »

Estoy usando un feed de wordpress, rss2.0.  Y creo que estoy usando las funciones nativas o me equivoco?  :P Me he dado cuenta que con Ajax es completamente mas facil de hacer pero quiero terminar lo que empese :P
En línea

Shit loads of money spend to show us wrong from right. Say no to war


Yasser Has Things To Say
WarZone
deya


Desconectado Desconectado

Mensajes: 378


Muñeca Princesa Deya Bella


Ver Perfil WWW
Re: XML, RSS
« Respuesta #5 en: 11 Junio 2007, 18:18 pm »

Existen 3 API's para el manejo de PHP y XML:

1) API DOM

2) API SAX

3) API Simple XML

Si quieres aprender a utilizarlas, te recomiendo veas o descargues los VT's 40, 41 y 42 del curso de Php y MySQL en http://www.illasaron.com/html

Salu2  ;)
En línea

"No es mas pobre el que tiene poco, sino el que mucho ambiciona" Charles Chaplin.
Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines