Jump to content

php xml Parsing.


expl0it

Recommended Posts

Hello there,

Im having a few problems with this.

 

firstly my code:

 

 <?php

    $file = "http://www.eve-markets.net/xml.php?listid=2363&key=v6UWzelPkcDrUjj";

    function contents($parser, $data){
        echo $data;
    }

    function startTag($parser, $data){
        echo "<b>";
    }

    function endTag($parser, $data){
        echo "</b><br />";
    }

    $xml_parser = xml_parser_create();

    xml_set_element_handler($xml_parser, "startTag", "endTag");

    xml_set_character_data_handler($xml_parser, "contents");

    $fp = fopen($file, "r");

    $data = fread($fp, 80000);

    if(!(xml_parse($xml_parser, $data, feof($fp)))){
        die("Error on line " . xml_get_current_line_number($xml_parser));
    }

    xml_parser_free($xml_parser);

    fclose($fp);

    ?>

xml sheet:http://www.eve-markets.net/xml.php?listid=2363&key=v6UWzelPkcDrUjj

 

i only want to parse the information between

<buy> </buy>

but im not too sure how to do this,

Anyone help please?

 

 

Link to comment
https://forums.phpfreaks.com/topic/199425-php-xml-parsing/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.