numberwizard68 Posted October 26, 2006 Share Posted October 26, 2006 <?phpfunction get_one_letter ( $str, $num ){ return substr($str, $num, ($num + 1));} function get_number_length ( $str ){ $str = substr($str, 17, strlen($str)); $d = 0; for( $x=0; $x { if(get_one_letter($str, $x) == "0" or get_one_letter($str, $x) == "1" or get_one_letter($str, $x) == "2" or get_one_letter($str, $x) == "3" or get_one_letter($str, $x) == "4" or get_one_letter($str, $x) == "5" or get_one_letter($str, $x) == "6" or get_one_letter($str, $x) == "7" or get_one_letter($str, $x) == "8" or get_one_letter($str, $x) == "9" or get_one_letter($str, $x) == ",") { $d++; } } return ($d + 17);}function str_num ($str){ $new_string = ereg_replace("[^0-9, ^,]", "", $str); echo($new_string);} $skills = array();$skills[0]['name'] = 'Overall';$skills[1]['name'] = 'Attack';$skills[2]['name'] = 'Defence';$skills[3]['name'] = 'Strength';$skills[4]['name'] = 'Hitpoints';$skills[5]['name'] = 'Ranged';$skills[6]['name'] = 'Prayer';$skills[7]['name'] = 'Magic';$skills[8]['name'] = 'Cooking';$skills[9]['name'] = 'Woodcutting';$file = file_get_contents("http://hiscore.runescape.com/lang/en/aff/runescape/hiscorepersonal.ws?user1=numberwizard");$file2 = fopen("http://hiscore.runescape.com/lang/en/aff/runescape/hiscorepersonal.ws?user1=numberwizard", "r");$filename = "http://hiscore.runescape.com/lang/en/aff/runescape/hiscorepersonal.ws?user1=numberwizard";$a = 3;while(!feof($file2)){ $line = fgets($file2); if($a == 3) { if($line == $skills[$b]['name']) { $a = 0; } } else if($a == 2) { $skills[$b]['rank'] = substr($line, 17, get_number_length($line)); echo("d"); $a++; } else { $a++; echo("v"); } } echo($skills[0]['rank']);?> Link to comment Share on other sites More sharing options...
insane Posted October 26, 2006 Share Posted October 26, 2006 I don't know much about PHP, but if(get_one_letter($str, $x) == "0" or get_one_letter($str, $x) == "1" or get_one_letter($str, $x) == "2" or get_one_letter($str, $x) == "3" or get_one_letter($str, $x) == "4" or get_one_letter($str, $x) == "5" or get_one_letter($str, $x) == "6" or get_one_letter($str, $x) == "7" or get_one_letter($str, $x) == "8" or get_one_letter($str, $x) == "9" or get_one_letter($str, $x) == ",") Isn't the 'or' syntax '||', and not 'or'? Link to comment Share on other sites More sharing options...
Cruiser Posted October 26, 2006 Share Posted October 26, 2006 Isn't the 'or' syntax '||', and not 'or'? PHP supports both || and using the actual word. I'm too noob at PHP to really figure out what's going on with your script by just looking at it. :x Link to comment Share on other sites More sharing options...
Nadril Posted October 26, 2006 Share Posted October 26, 2006 What exactly is it doing wrong? Just not working at all or?... I'm trying to look at it. Don't have any experience in PHP so i'm probaly not going to be much of a help, but it looks a good bit like C++ in parts. Link to comment Share on other sites More sharing options...
runesmithie Posted October 26, 2006 Share Posted October 26, 2006 What exactly is it doing wrong? Just not working at all or?... I'm trying to look at it. Don't have any experience in PHP so i'm probaly not going to be much of a help, but it looks a good bit like C++ in parts. The current output would be handy :P You should also set up some debugging inside there so you can see just where it fails also ;) I just posted something! ^_^ to the terrorist...er... kirbybeam. Link to comment Share on other sites More sharing options...
adthegreat- Posted October 26, 2006 Share Posted October 26, 2006 Well i quickly copied it and put it on my server, and the output was completely blank, it doesn't echo anything at all. I'm (like everyone else who posted :oops: ) not the greatest at PHP, but interestingly enough i was looking at .org/archive/index.php/t-123101.html]this earlier tonight, it may be able to help you! Edit: Unfortunately the site i was looking at is apparently a cheat site, but my guess is that if you search for 'retrieving data using php runescape highscores' you'll find what you are looking for. Link to comment Share on other sites More sharing options...
numberwizard68 Posted October 26, 2006 Author Share Posted October 26, 2006 Thanks, ad. I found a good site for this Link to comment Share on other sites More sharing options...
insane Posted October 27, 2006 Share Posted October 27, 2006 Isn't the 'or' syntax '||', and not 'or'? PHP supports both || and using the actual word. I'm too noob at PHP to really figure out what's going on with your script by just looking at it. :x w3schools needs to add that in :P they just say || is the or function. Link to comment Share on other sites More sharing options...
Cruiser Posted October 27, 2006 Share Posted October 27, 2006 Php.net will knock the socks off whatever w3schools has posted for php help. Nothing beats the language documentation. :P Here be the "or" page since it was brough up. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now