FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

php runescape highscorez

 


tyxl
Anny1 got an idea where my mistake is?

Code:

<?php
 $user = $_GET['user'];
 $handle = file_get_contents("http://hiscore.runescape.com:80/aff/runescape/hiscorepersonal.cgi?username=$user","r")
    or exit("Unable to open hiscore table");
 $array; $stats;

 while (!feof($handle)) {
    $buffer = fgets($handle, 4096);
    $temparray = array(rtrim(strip_tags($buffer)));
    $array = array_merge($array, $temparray);
 }
 fclose($handle);

 $im = imagecreatefrompng("stats.png");
 $color = imagecolorallocate($im, 255, 255, 255);

 imagestring($im, 4, (213 - (((strlen($user)*6) + (strlen($user)*2) - 2)/2)), ((24+36)/2-8), $user, $color);

 $i = 0;
 foreach($array as $value){
     if(strcasecmp( $value, "Overall") == 0 ) {
                imagestring($im, 2, 211,51, $array[$i+2], $color);
    } elseif(strcasecmp( $value, "Attack") == 0 ) {
       imagestring($im, 2, 48, 30, $array[$i+2], $color);
      $Attack = $array[$i+2];
    } elseif(strcasecmp( $value, "Defence") == 0 ) {
      imagestring($im, 2, 48, 98, $array[$i+2], $color);
      $Defence = $array[$i+2];
    } elseif(strcasecmp( $value, "Strength") == 0 ) {
      imagestring($im, 2, 48, 64, $array[$i+2], $color);
      $Strength = $array[$i+2];
    } elseif(strcasecmp( $value, "Hitpoints") == 0 ) {
      imagestring($im, 2, 146, 30, $array[$i+2], $color);
      $Hitpoints = $array[$i+2];
    } elseif(strcasecmp( $value, "Ranged") == 0 ) {
      imagestring($im, 2, 97, 64, $array[$i+2], $color);
      $Ranged = $array[$i+2];
    } elseif(strcasecmp( $value, "Prayer") == 0 ) {
      imagestring($im, 2, 97, 98, $array[$i+2], $color);
      $Prayer = $array[$i+2];
    } elseif(strcasecmp( $value, "Magic") == 0 ) {
      imagestring($im, 2, 97, 30, $array[$i+2], $color);
      $Magic = $array[$i+2];
    } elseif(strcasecmp( $value, "Cooking") == 0 ) {
      imagestring($im, 2, 293, 98, $array[$i+2], $color);
    } elseif(strcasecmp( $value, "Woodcutting") == 0 ) {
      imagestring($im, 2, 293, 30, $array[$i+2], $color);
    } elseif(strcasecmp( $value, "Fletching") == 0 ) {
      imagestring($im, 2, 391, 64, $array[$i+2], $color);
    } elseif(strcasecmp( $value, "Fishing") == 0 ) {
      imagestring($im, 2, 342, 30, $array[$i+2], $color);
    } elseif(strcasecmp( $value, "Firemaking") == 0 ) {
       imagestring($im, 2, 293, 64, $array[$i+2], $color);
    } elseif(strcasecmp( $value, "Crafting") == 0 ) {
       imagestring($im, 2, 195, 98, $array[$i+2], $color);
    } elseif(strcasecmp( $value, "Smithing") == 0 ) {
       imagestring($im, 2, 146, 98, $array[$i+2], $color);
    } elseif(strcasecmp( $value, "Mining") == 0 ) {
       imagestring($im, 2, 146, 64, $array[$i+2], $color);
    } elseif(strcasecmp( $value, "Herblore") == 0 ) {
      imagestring($im, 2, 342, 98, $array[$i+2], $color);
    } elseif(strcasecmp( $value, "Agility") == 0 ) {
      imagestring($im, 2, 342, 64, $array[$i+2], $color);
    } elseif(strcasecmp( $value, "Thieving") == 0 ) {
       imagestring($im, 2, 391, 30, $array[$i+2], $color);
   } elseif(strcasecmp( $value, "Slayer") == 0 ) {
       imagestring($im, 2, 391, 98, $array[$i+2], $color);
    } elseif(strcasecmp( $value, "Runecrafting") == 0 ) {
       imagestring($im, 2, 244, 98, $array[$i+2], $color);
   }
 $i++;
}
 $level = ((($Attack * 0.36 + $Strength * 0.29)) + (($Defence + $Hitpoints) * .25) + ($Prayer * .125));
 imagestring($im, 2, 211, 63, $level, $color);
 
 header("Content-type: image/png");
 imagepng($im);
?>


thx
Vasquez
It might help if you said what the problem is that you're experiencing. Not everybody is going to analyse your code-snippet without at least some indication of what issues you are having...
tyxl
I did upload the fille. And it's producing a never ending error. But i don't want to put it into an immage. I just want to take the values out of the highscorez as strings. There is no need to export them into an image.
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.