October 26, 200619 yr <?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']);?>
October 26, 200619 yr 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'?
October 26, 200619 yr 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
October 26, 200619 yr 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.
October 26, 200619 yr 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.
October 26, 200619 yr 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.
October 27, 200619 yr 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.
October 27, 200619 yr 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.
Create an account or sign in to comment