Skip to content
View in the app

A better way to browse. Learn more.

Tip.It Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

PHP Trouble

Featured Replies





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

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

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.

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.

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

 

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

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

Important Information

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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.