|
||
|
|||||||
| Script Languages Perl/PHP/Python/Ruby so on and so forth. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Forum Expert
|
So theres a page that prints out TRUE or False depending on if a certain texts exists in the database...
(The source) HTML Code:
<?xml version="1.0" encoding="ISO-8859-1"?> <api> <gamertag>True</gamertag> </api> I have been trying this: PHP Code:
__________________
Everytime a puppy gets hit by a car from me smoking I take another drag, point, and laugh. |
|
|
|
|
|
#2 (permalink) |
|
Forum Expert
Join Date: Nov 2003
Location: Illinois, USA
Age: 21
Posts: 2,911
|
Wait in a database or an XML file?
For an XML file, you could parse it real quick and just get the result...
__________________
Useful links (Use them or die in a fire!!!): Ultimate Little Guide, C# Tutorials & Docs, RunUO Basic Scripts, Run UO How to..., Configure server for connections, Scripting for Dummies, Common Problem Solutions, FAQ Forum, RunUO Wiki, Basic Generics, Xml Tutorial |
|
|
|
|
|
#3 (permalink) |
|
Forum Expert
|
Its the website...
http://www.360voice.com/api/gamertag...(Inserttaghere) If your gamer tag is registered on 360voice.com it returns "True" if it is not it returns "False" http://www.360voice.com/api/gamertag...g=nott32Nott32 will return true because I am registered with 360voice.com I jsut need the script to read if it says true or not so that it will not display errors if it is not valid (Just come up with a set message) and if it is valid it will display another PHP page(and or text)(Using include command) EDIT: the link I used above was incoorect....sorry http://www.360voice.com/api/gamertag-exists.asp?tag=
__________________
Everytime a puppy gets hit by a car from me smoking I take another drag, point, and laugh. |
|
|
|
|
|
#4 (permalink) |
|
Forum Expert
Join Date: Nov 2003
Location: Illinois, USA
Age: 21
Posts: 2,911
|
actually it returns this
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?> - <!-- Function to retrieve XML -->; - <!-- requires passed XSL -->; - <api> - <info> <gamertag>Nott32</gamertag> <score>1380</score> <change>0</change> <total>11</total> <mostplayed>n/a</mostplayed> </info> - <leaderboards> - <leaderboard name="gs"> <name>Top Gamerscore</name> <rank>52558</rank> <url>http://www.360voice.com/leader-gs.asp?start=52557</url> </leaderboard> - <leaderboard name="gsc"> <name>Daily Gamerscore Change</name> <rank>45418</rank> <url>http://www.360voice.com/leader-gsc.asp?start=45417</url> </leaderboard> - <leaderboard name="mpg"> <name>Total Games Played</name> <rank>58390</rank> <url>http://www.360voice.com/leader-mpg.asp?start=58389</url> </leaderboard> </leaderboards> </api> Code:
<?xml version="1.0" encoding="ISO-8859-1" ?> - <!-- Function to retrieve XML -->; - <!-- requires passed XSL -->; <api />
__________________
Useful links (Use them or die in a fire!!!): Ultimate Little Guide, C# Tutorials & Docs, RunUO Basic Scripts, Run UO How to..., Configure server for connections, Scripting for Dummies, Common Problem Solutions, FAQ Forum, RunUO Wiki, Basic Generics, Xml Tutorial Last edited by mordero; 01-29-2007 at 09:45 PM. |
|
|
|
|
|
#5 (permalink) |
|
Forum Expert
Join Date: Nov 2003
Location: Illinois, USA
Age: 21
Posts: 2,911
|
ohhh lol, well the same thing, really there is no need to actually parse this since it is so short. Just check if the returned string contains "True" or "False"/"Invalid"
__________________
Useful links (Use them or die in a fire!!!): Ultimate Little Guide, C# Tutorials & Docs, RunUO Basic Scripts, Run UO How to..., Configure server for connections, Scripting for Dummies, Common Problem Solutions, FAQ Forum, RunUO Wiki, Basic Generics, Xml Tutorial |
|
|
|
|
|
#6 (permalink) |
|
Forum Expert
|
lol *Neb alert* how would I do that?
My Attmept: PHP Code:
__________________
Everytime a puppy gets hit by a car from me smoking I take another drag, point, and laugh. Last edited by Nott32; 01-29-2007 at 09:50 PM. |
|
|
|
|
|
#7 (permalink) |
|
Forum Expert
Join Date: Nov 2003
Location: Illinois, USA
Age: 21
Posts: 2,911
|
PHP: stristr - Manual <---
PHP Code:
__________________
Useful links (Use them or die in a fire!!!): Ultimate Little Guide, C# Tutorials & Docs, RunUO Basic Scripts, Run UO How to..., Configure server for connections, Scripting for Dummies, Common Problem Solutions, FAQ Forum, RunUO Wiki, Basic Generics, Xml Tutorial |
|
|
|
|
|
#8 (permalink) |
|
Forum Expert
Join Date: Nov 2003
Location: Illinois, USA
Age: 21
Posts: 2,911
|
remember when you are checking to see if something is equivalent to something else to always use at least two =, other wise, it will reassign the variable you are trying to check and if that reassignment worked (which is almost always will for variables), returns true.
__________________
Useful links (Use them or die in a fire!!!): Ultimate Little Guide, C# Tutorials & Docs, RunUO Basic Scripts, Run UO How to..., Configure server for connections, Scripting for Dummies, Common Problem Solutions, FAQ Forum, RunUO Wiki, Basic Generics, Xml Tutorial |
|
|
|
|
|
#9 (permalink) |
|
Forum Expert
|
PHP Code:
__________________
Everytime a puppy gets hit by a car from me smoking I take another drag, point, and laugh. |
|
|
|
|
|
#10 (permalink) |
|
Forum Expert
Join Date: Nov 2003
Location: Illinois, USA
Age: 21
Posts: 2,911
|
no, you need to open the file like you were earlier. and the do that if statement on your $data
__________________
Useful links (Use them or die in a fire!!!): Ultimate Little Guide, C# Tutorials & Docs, RunUO Basic Scripts, Run UO How to..., Configure server for connections, Scripting for Dummies, Common Problem Solutions, FAQ Forum, RunUO Wiki, Basic Generics, Xml Tutorial |
|
|
|
|
|
#11 (permalink) |
|
Account Terminated
Join Date: Jun 2004
Location: Cincinnati, Ohio
Age: 20
Posts: 3,954
|
Use PHP's XML parsing library.
Reading and writing the XML DOM with PHP Or well, I guess if you just want that one tag, your solution works fine. |
|
|
|
|
|
#12 (permalink) |
|
Forum Expert
Join Date: Nov 2003
Location: Illinois, USA
Age: 21
Posts: 2,911
|
yeah, no point parsing it for just that one thing
![]()
__________________
Useful links (Use them or die in a fire!!!): Ultimate Little Guide, C# Tutorials & Docs, RunUO Basic Scripts, Run UO How to..., Configure server for connections, Scripting for Dummies, Common Problem Solutions, FAQ Forum, RunUO Wiki, Basic Generics, Xml Tutorial |
|
|
|
|
|
#14 (permalink) |
|
Master of the Internet
Join Date: Oct 2005
Age: 44
Posts: 6,283
|
Frankly, I'm old, fat, and lazy, but given a chance to learn with a tool provided (by WarAngel), I think I'd try to implement a full parsing method so I could learn and make the code more easily used in the future.
__________________
Why is it that I'm never as smart as I thought I was yesterday? My vast knowledge is only surpassed by my infinite ignorance. <TheOutkastDev> i might have to hire an assassin to killl mal so that i can jump in front of the bullet and piss on him |
|
|
|
|
|
#15 (permalink) |
|
Forum Expert
Join Date: Nov 2003
Location: Illinois, USA
Age: 21
Posts: 2,911
|
but there isnt a reason to for that part, now once he checks if the gamertag exists and he wants to pull information from the other xml file, then yes, he should parse it, but for this, its a waste of resources
__________________
Useful links (Use them or die in a fire!!!): Ultimate Little Guide, C# Tutorials & Docs, RunUO Basic Scripts, Run UO How to..., Configure server for connections, Scripting for Dummies, Common Problem Solutions, FAQ Forum, RunUO Wiki, Basic Generics, Xml Tutorial |
|
|
|
|
|
#16 (permalink) |
|
Forum Expert
|
it works :-) It now checks the URL using a series of vatiables. I also figured out how to parse the gamer-leaderboards using preg_replace soI have one script that does all that and gets true/false. THanks Mordero! and thank you for the link WA.
__________________
Everytime a puppy gets hit by a car from me smoking I take another drag, point, and laugh. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|