Go Back   RunUO - Ultima Online Emulation > Developer's Corner > Programming > Script Languages

Script Languages Perl/PHP/Python/Ruby so on and so forth.

Reply
 
Thread Tools Display Modes
Old 01-29-2007, 07:16 PM   #1 (permalink)
Forum Expert
 
Nott32's Avatar
 
Join Date: Feb 2006
Location: In front of my computer...
Age: 17
Posts: 562
Send a message via MSN to Nott32 Send a message via Yahoo to Nott32
Default XML Page Parser

This is a script I found earlier that will parse XML files into a nice list... I modified it for use with the consti GamerTag script. I use it on my new site to display information then I use another script to parse the page...

I use it with 360voice.com API.

PHP Code:
<?php
// http://www.nottnetworks.com/gamertag/
// A Nott32 script (http://www.nottnetworks.com)
 

//Requires the Consti GamerTag script: http://consti.de/external/gamercard/
include 'gamercard.php'//Used so the system can use the $tag

//Parses the 360Voice.com Leaderboard for specified tag (XML) 
//Change the URL to whatever the XML document is
//For the 360voice.com API list go to http://360voice.wetpaint.com/page/API
$file 'http://www.360voice.com/api/gamertag-leaderboard.asp?tag='.$tag//Page to Parse

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($fp80000); 

if(!(
xml_parse($xml_parser$datafeof($fp)))){ 
    die(
'Error on line ' xml_get_current_line_number($xml_parser));


xml_parser_free($xml_parser); 

fclose($fp); 

?>
__________________
Everytime a puppy gets hit by a car from me smoking I take another drag, point, and laugh.
Nott32 is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5