Jump to content

PHP Trouble


numberwizard68

Recommended Posts





<?php



function 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']);



?>



Numberwizard.png

numberwizard.png

Link to comment
Share on other sites

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'?

summerpngwy6.jpg
Link to comment
Share on other sites

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

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

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 ;)

smithie3.jpg

I just posted something! ^_^ to the terrorist...er... kirbybeam.
Link to comment
Share on other sites

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.

manipofsarahs1gg5.png
Link to comment
Share on other sites

 

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.

summerpngwy6.jpg
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.