Dusaro Posted October 22, 2011 Share Posted October 22, 2011 I coded this, it has over 600 lines... Im not sure if I should post all of it so I will. When using a account that does not exist it gives an "failed to open stream Error". <?php $user = "S U O M I"; $user1 = "Tezz"; if(isset($_GET['user'])) { if(!empty($_GET['user'])) { $user = $_GET['user']; } } if(isset($_GET['user1'])) { if(!empty($_GET['user1'])) { $user1 = $_GET['user1']; } } //Skill Grabs $order = array("Overall", "Attack", "Defence", "Strength", "Hitpoints", "Ranged", "Prayer", "Magic", "Cooking", "Woodcutting", "Fletching", "Fishing", "Firemaking", "Crafting", "Smithing", "Mining", "Herblore", "Agility", "Thieving", "Slayer", "Farming", "Runecraft", "Hunter", "Construction", "Summoning", "Dungeoneering"); $get = file_get_contents("http://hiscore.runescape.com/index_lite.ws?player=$user"); $get = explode("\n", $get); $i = 0; foreach ($order as $key => $value) { $value = strtolower($value); $temp = explode(",", $get[$i]); $temp = array("rank" => $temp[0], "level" => $temp[1], "exp" => $temp[2]); $stats[$value] = $temp; $eval = "\$$value = array(\$temp[\"rank\"], \$temp[\"level\"], \$temp[\"exp\"]);"; eval($eval); $i++; } //End Skill Grabs $order1 = array("Overall1", "Attack1", "Defence1", "Strength1", "Hitpoints1", "Ranged1", "Prayer1", "Magic1", "Cooking1", "Woodcutting1", "Fletching1", "Fishing1", "Firemaking1", "Crafting1", "Smithing1", "Mining1", "Herblore1", "Agility1", "Thieving1", "Slayer1", "Farming1", "Runecraft1", "Hunter1", "Construction1", "Summoning1", "Dungeoneering1"); $get1 = file_get_contents("http://hiscore.runescape.com/index_lite.ws?player=$user1"); $get1 = explode("\n", $get1); $i1 = 0; foreach ($order1 as $key1 => $value1) { $value1 = strtolower($value1); $temp1 = explode(",", $get1[$i1]); $temp1 = array("rank1" => $temp1[0], "level1" => $temp1[1], "exp1" => $temp1[2]); $stats1[$value1] = $temp1; $eval1 = "\$$value1 = array(\$temp1[\"rank1\"], \$temp1[\"level1\"], \$temp1[\"exp1\"]);"; eval($eval1); $i1++; } //End Skill Grabs echo "<table border='1' cellpadding='5'>"; echo "<tr>"; echo "<td colspan='4'><b><center>".strtoupper($user)."</center></b></td>"; echo "<td></td>"; echo "<td colspan='4'><b><center>".strtoupper($user1)."</center></b></td>"; echo "</tr>"; echo "<tr>"; echo "<td><b>Skills</b></td>"; echo "<td><b>Rank</b></td>"; echo "<td><b>Level</b></td>"; echo "<td><b>XP</b></td>"; echo "<td></td>"; echo "<td><b>Skills</b></td>"; echo "<td><b>Rank</b></td>"; echo "<td><b>Level</b></td>"; echo "<td><b>XP</b></td>"; echo "</tr>"; echo "<tr>"; echo "<td><b>Overall</b></td>"; echo "<td>";if($overall[0]<=-1){echo "Not Ranked";}else{echo $overall[0];} echo "</td>"; echo "<td>".$overall[1]."</td>"; echo "<td>".$overall[2]."</td>"; echo "<td>"; if ($overall[2] == $overall1[2]){ echo "<img src='images/equal.png' />"; } elseif ($overall[2] <= $overall1[2]){ echo "<img src='images/downArrow.png' />"; } elseif ($overall[2] >= $overall1[2]){ echo "<img src='images/upArrow.png' />"; } echo "</td>"; echo "<td><b>Overall</b></td>"; echo "<td>";if($overall1[0]<=-1){echo "Not Ranked";}else{echo $overall1[0];} echo "</td>"; echo "<td>".$overall1[1]."</td>"; echo "<td>".$overall1[2]."</td>"; echo "</tr>"; echo "<tr>"; echo "<td><b>Attack</b></td>"; echo "<td>";if($attack[0]<=-1){echo "Not Ranked";}else{echo $attack[0];} echo "</td>"; echo "<td>".$attack[1]."</td>"; echo "<td>".$attack[2]."</td>"; echo "<td>"; if ($attack[2] == $attack1[2]){ echo "<img src='images/equal.png' />"; } elseif ($attack[2] <= $attack1[2]){ echo "<img src='images/downArrow.png' />"; } elseif ($attack[2] >= $attack1[2]){ echo "<img src='images/upArrow.png' />"; } echo "</td>"; echo "<td><b>Attack</b></td>"; echo "<td>";if($attack1[0]<=-1){echo "Not Ranked";}else{echo $attack1[0];} echo "</td>"; echo "<td>".$attack1[1]."</td>"; echo "<td>".$attack1[2]."</td>"; echo "</tr>"; echo "<tr>"; echo "<td><b>Defence</b></td>"; echo "<td>";if($defence[0]<=-1){echo "Not Ranked";}else{echo $defence[0];} echo "</td>"; echo "<td>".$defence[1]."</td>"; echo "<td>".$defence[2]."</td>"; echo "<td>"; if ($defence[2] == $defence1[2]){ echo "<img src='images/equal.png' />"; } elseif ($defence[2] <= $defence1[2]){ echo "<img src='images/downArrow.png' />"; } elseif ($defence[2] >= $defence1[2]){ echo "<img src='images/upArrow.png' />"; } echo "</td>"; echo "<td><b>Defence</b></td>"; echo "<td>";if($defence1[0]<=-1){echo "Not Ranked";}else{echo $defence1[0];} echo "</td>"; echo "<td>".$defence1[1]."</td>"; echo "<td>".$defence1[2]."</td>"; echo "</tr>"; echo "<tr>"; echo "<td><b>Strength</b></td>"; echo "<td>";if($strength[0]<=-1){echo "Not Ranked";}else{echo $strength[0];} echo "</td>"; echo "<td>".$strength[1]."</td>"; echo "<td>".$strength[2]."</td>"; echo "<td>"; if ($strength[2] == $strength1[2]){ echo "<img src='images/equal.png' />"; } elseif ($strength[2] <= $strength1[2]){ echo "<img src='images/downArrow.png' />"; } elseif ($strength[2] >= $strength1[2]){ echo "<img src='images/upArrow.png' />"; } echo "</td>"; echo "<td><b>Strength</b></td>"; echo "<td>";if($strength1[0]<=-1){echo "Not Ranked";}else{echo $strength1[0];} echo "</td>"; echo "<td>".$strength1[1]."</td>"; echo "<td>".$strength1[2]."</td>"; echo "</tr>"; echo "<tr>"; echo "<td><b>Constitution</b></td>"; echo "<td>";if($hitpoints[0]<=-1){echo "Not Ranked";}else{echo $hitpoints[0];} echo "</td>"; echo "<td>".$hitpoints[1]."</td>"; echo "<td>".$hitpoints[2]."</td>"; echo "<td>"; if ($hitpoints[2] == $hitpoints1[2]){ echo "<img src='images/equal.png' />"; } elseif ($hitpoints[2] <= $hitpoints1[2]){ echo "<img src='images/downArrow.png' />"; } elseif ($hitpoints[2] >= $hitpoints1[2]){ echo "<img src='images/upArrow.png' />"; } echo "</td>"; echo "<td><b>Constitution</b></td>"; echo "<td>";if($hitpoints1[0]<=-1){echo "Not Ranked";}else{echo $hitpoints1[0];} echo "</td>"; echo "<td>".$hitpoints1[1]."</td>"; echo "<td>".$hitpoints1[2]."</td>"; echo "</tr>"; echo "<tr>"; echo "<td><b>Ranged</b></td>"; echo "<td>";if($ranged[0]<=-1){echo "Not Ranked";}else{echo $ranged[0];} echo "</td>"; echo "<td>".$ranged[1]."</td>"; echo "<td>".$ranged[2]."</td>"; echo "<td>"; if ($ranged[2] == $ranged1[2]){ echo "<img src='images/equal.png' />"; } elseif ($ranged[2] <= $ranged1[2]){ echo "<img src='images/downArrow.png' />"; } elseif ($ranged[2] >= $ranged1[2]){ echo "<img src='images/upArrow.png' />"; } echo "</td>"; echo "<td><b>Ranged</b></td>"; echo "<td>";if($ranged1[0]<=-1){echo "Not Ranked";}else{echo $ranged1[0];} echo "</td>"; echo "<td>".$ranged1[1]."</td>"; echo "<td>".$ranged1[2]."</td>"; echo "</tr>"; echo "<tr>"; echo "<td><b>Prayer</b></td>"; echo "<td>";if($prayer[0]<=-1){echo "Not Ranked";}else{echo $prayer[0];} echo "</td>"; echo "<td>".$prayer[1]."</td>"; echo "<td>".$prayer[2]."</td>"; echo "<td>"; if ($prayer[2] == $prayer1[2]){ echo "<img src='images/equal.png' />"; } elseif ($prayer[2] <= $prayer1[2]){ echo "<img src='images/downArrow.png' />"; } elseif ($prayer[2] >= $prayer1[2]){ echo "<img src='images/upArrow.png' />"; } echo "</td>"; echo "<td><b>Prayer</b></td>"; echo "<td>";if($prayer1[0]<=-1){echo "Not Ranked";}else{echo $prayer1[0];} echo "</td>"; echo "<td>".$prayer1[1]."</td>"; echo "<td>".$prayer1[2]."</td>"; echo "</tr>"; echo "<tr>"; echo "<td><b>Magic</b></td>"; echo "<td>";if($magic[0]<=-1){echo "Not Ranked";}else{echo $magic[0];} echo "</td>"; echo "<td>".$magic[1]."</td>"; echo "<td>".$magic[2]."</td>"; echo "<td>"; if ($magic[2] == $magic1[2]){ echo "<img src='images/equal.png' />"; } elseif ($magic[2] <= $magic1[2]){ echo "<img src='images/downArrow.png' />"; } elseif ($magic[2] >= $magic1[2]){ echo "<img src='images/upArrow.png' />"; } echo "</td>"; echo "<td><b>Magic</b></td>"; echo "<td>";if($magic1[0]<=-1){echo "Not Ranked";}else{echo $magic1[0];} echo "</td>"; echo "<td>".$magic1[1]."</td>"; echo "<td>".$magic1[2]."</td>"; echo "</tr>"; echo "<tr>"; echo "<td><b>Cooking</b></td>"; echo "<td>";if($cooking[0]<=-1){echo "Not Ranked";}else{echo $cooking[0];} echo "</td>"; echo "<td>".$cooking[1]."</td>"; echo "<td>".$cooking[2]."</td>"; echo "<td>"; if ($cooking[2] == $cooking1[2]){ echo "<img src='images/equal.png' />"; } elseif ($cooking[2] <= $cooking1[2]){ echo "<img src='images/downArrow.png' />"; } elseif ($cooking[2] >= $cooking1[2]){ echo "<img src='images/upArrow.png' />"; } echo "</td>"; echo "<td><b>Cooking</b></td>"; echo "<td>";if($cooking1[0]<=-1){echo "Not Ranked";}else{echo $cooking1[0];} echo "</td>"; echo "<td>".$cooking1[1]."</td>"; echo "<td>".$cooking1[2]."</td>"; echo "</tr>"; echo "<tr>"; echo "<td><b>Woodcutting</b></td>"; echo "<td>";if($woodcutting[0]<=-1){echo "Not Ranked";}else{echo $woodcutting[0];} echo "</td>"; echo "<td>".$woodcutting[1]."</td>"; echo "<td>".$woodcutting[2]."</td>"; echo "<td>"; if ($woodcutting[2] == $woodcutting1[2]){ echo "<img src='images/equal.png' />"; } elseif ($woodcutting[2] <= $woodcutting1[2]){ echo "<img src='images/downArrow.png' />"; } elseif ($woodcutting[2] >= $woodcutting1[2]){ echo "<img src='images/upArrow.png' />"; } echo "</td>"; echo "<td><b>Woodcutting</b></td>"; echo "<td>";if($woodcutting1[0]<=-1){echo "Not Ranked";}else{echo $woodcutting1[0];} echo "</td>"; echo "<td>".$woodcutting1[1]."</td>"; echo "<td>".$woodcutting1[2]."</td>"; echo "</tr>"; echo "<tr>"; echo "<td><b>Fletching</b></td>"; echo "<td>".$fletching[0]."</td>"; echo "<td>".$fletching[1]."</td>"; echo "<td>".$fletching[2]."</td>"; echo "<td>"; if ($fletching[2] == $fletching1[2]){ echo "<img src='images/equal.png' />"; } elseif ($fletching[2] <= $fletching1[2]){ echo "<img src='images/downArrow.png' />"; } elseif ($fletching[2] >= $fletching1[2]){ echo "<img src='images/upArrow.png' />"; } echo "</td>"; echo "<td><b>Fletching</b></td>"; echo "<td>";if($fletching1[0]<=-1){echo "Not Ranked";}else{echo $fletching1[0];} echo "</td>"; echo "<td>".$fletching1[1]."</td>"; echo "<td>".$fletching1[2]."</td>"; echo "</tr>"; echo "<tr>"; echo "<td><b>Fishing</b></td>"; echo "<td>";if($fishing[0]<=-1){echo "Not Ranked";}else{echo $fishing[0];} echo "</td>"; echo "<td>".$fishing[1]."</td>"; echo "<td>".$fishing[2]."</td>"; echo "<td>"; if ($fishing[2] == $fishing1[2]){ echo "<img src='images/equal.png' />"; } elseif ($fishing[2] <= $fishing1[2]){ echo "<img src='images/downArrow.png' />"; } elseif ($fishing[2] >= $fishing1[2]){ echo "<img src='images/upArrow.png' />"; } echo "</td>"; echo "<td><b>Fishing</b></td>"; echo "<td>";if($fishing1[0]<=-1){echo "Not Ranked";}else{echo $fishing1[0];} echo "</td>"; echo "<td>".$fishing1[1]."</td>"; echo "<td>".$fishing1[2]."</td>"; echo "</tr>"; echo "<tr>"; echo "<td><b>Firemaking</b></td>"; echo "<td>";if($firemaking[0]<=-1){echo "Not Ranked";}else{echo $firemaking[0];} echo "</td>"; echo "<td>".$firemaking[1]."</td>"; echo "<td>".$firemaking[2]."</td>"; echo "<td>"; if ($firemaking[2] == $firemaking1[2]){ echo "<img src='images/equal.png' />"; } elseif ($firemaking[2] <= $firemaking1[2]){ echo "<img src='images/downArrow.png' />"; } elseif ($firemaking[2] >= $firemaking1[2]){ echo "<img src='images/upArrow.png' />"; } echo "</td>"; echo "<td><b>Firemaking</b></td>"; echo "<td>";if($firemaking1[0]<=-1){echo "Not Ranked";}else{echo $firemaking1[0];} echo "</td>"; echo "<td>".$firemaking1[1]."</td>"; echo "<td>".$firemaking1[2]."</td>"; echo "</tr>"; echo "<tr>"; echo "<td><b>Crafting</b></td>"; echo "<td>";if($crafting[0]<=-1){echo "Not Ranked";}else{echo $crafting[0];} echo "</td>"; echo "<td>".$crafting[1]."</td>"; echo "<td>".$crafting[2]."</td>"; echo "<td>"; if ($crafting[2] == $crafting1[2]){ echo "<img src='images/equal.png' />"; } elseif ($crafting[2] <= $crafting1[2]){ echo "<img src='images/downArrow.png' />"; } elseif ($crafting[2] >= $crafting1[2]){ echo "<img src='images/upArrow.png' />"; } echo "</td>"; echo "<td><b>Crafting</b></td>"; echo "<td>";if($crafting1[0]<=-1){echo "Not Ranked";}else{echo $crafting1[0];} echo "</td>";; echo "<td>".$crafting1[1]."</td>"; echo "<td>".$crafting1[2]."</td>"; echo "</tr>"; echo "<tr>"; echo "<td><b>Smithing</b></td>"; echo "<td>";if($smithing[0]<=-1){echo "Not Ranked";}else{echo $smithing[0];} echo "</td>"; echo "<td>".$smithing[1]."</td>"; echo "<td>".$smithing[2]."</td>"; echo "<td>"; if ($smithing[2] == $smithing1[2]){ echo "<img src='images/equal.png' />"; } elseif ($smithing[2] <= $smithing1[2]){ echo "<img src='images/downArrow.png' />"; } elseif ($smithing[2] >= $smithing1[2]){ echo "<img src='images/upArrow.png' />"; } echo "</td>"; echo "<td><b>Smithing</b></td>"; echo "<td>";if($smithing1[0]<=-1){echo "Not Ranked";}else{echo $smithing1[0];} echo "</td>"; echo "<td>".$smithing1[1]."</td>"; echo "<td>".$smithing1[2]."</td>"; echo "</tr>"; echo "<tr>"; echo "<td><b>Mining</b></td>"; echo "<td>";if($mining[0]<=-1){echo "Not Ranked";}else{echo $mining[0];} echo "</td>"; echo "<td>".$mining[1]."</td>"; echo "<td>".$mining[2]."</td>"; echo "<td>"; if ($mining[2] == $mining1[2]){ echo "<img src='images/equal.png' />"; } elseif ($mining[2] <= $mining1[2]){ echo "<img src='images/downArrow.png' />"; } elseif ($mining[2] >= $mining1[2]){ echo "<img src='images/upArrow.png' />"; } echo "</td>"; echo "<td><b>Mining</b></td>"; echo "<td>";if($mining1[0]<=-1){echo "Not Ranked";}else{echo $mining1[0];} echo "</td>"; echo "<td>".$mining1[1]."</td>"; echo "<td>".$mining1[2]."</td>"; echo "</tr>"; echo "<tr>"; echo "<td><b>Herblore</b></td>"; echo "<td>";if($herblore[0]<=-1){echo "Not Ranked";}else{echo $herblore[0];} echo "</td>"; echo "<td>".$herblore[1]."</td>"; echo "<td>".$herblore[2]."</td>"; echo "<td>"; if ($herblore[2] == $herblore1[2]){ echo "<img src='images/equal.png' />"; } elseif ($herblore[2] <= $herblore1[2]){ echo "<img src='images/downArrow.png' />"; } elseif ($herblore[2] >= $herblore1[2]){ echo "<img src='images/upArrow.png' />"; } echo "</td>"; echo "<td><b>Herblore</b></td>"; echo "<td>";if($herblore1[0]<=-1){echo "Not Ranked";}else{echo $herblore1[0];} echo "</td>"; echo "<td>".$herblore1[1]."</td>"; echo "<td>".$herblore1[2]."</td>"; echo "</tr>"; echo "<tr>"; echo "<td><b>Agility</b></td>"; echo "<td>";if($agility[0]<=-1){echo "Not Ranked";}else{echo $agility[0];} echo "</td>"; echo "<td>".$agility[1]."</td>"; echo "<td>".$agility[2]."</td>"; echo "<td>"; if ($agility[2] == $agility1[2]){ echo "<img src='images/equal.png' />"; } elseif ($agility[2] <= $agility1[2]){ echo "<img src='images/downArrow.png' />"; } elseif ($agility[2] >= $agility1[2]){ echo "<img src='images/upArrow.png' />"; } echo "</td>"; echo "<td><b>Agility</b></td>"; echo "<td>";if($agility1[0]<=-1){echo "Not Ranked";}else{echo $agility1[0];} echo "</td>"; echo "<td>".$agility1[1]."</td>"; echo "<td>".$agility1[2]."</td>"; echo "</tr>"; echo "<tr>"; echo "<td><b>Thieving</b></td>"; echo "<td>";if($thieving[0]<=-1){echo "Not Ranked";}else{echo $thieving[0];} echo "</td>"; echo "<td>".$thieving[1]."</td>"; echo "<td>".$thieving[2]."</td>"; echo "<td>"; if ($thieving[2] == $thieving1[2]){ echo "<img src='images/equal.png' />"; } elseif ($thieving[2] <= $thieving1[2]){ echo "<img src='images/downArrow.png' />"; } elseif ($thieving[2] >= $thieving1[2]){ echo "<img src='images/upArrow.png' />"; } echo "</td>"; echo "<td><b>Thieving</b></td>"; echo "<td>";if($thieving1[0]<=-1){echo "Not Ranked";}else{echo $thieving[0];} echo "</td>"; echo "<td>".$thieving1[1]."</td>"; echo "<td>".$thieving1[2]."</td>"; echo "</tr>"; echo "<tr>"; echo "<td><b>Slayer</b></td>"; echo "<td>";if($slayer[0]<=-1){echo "Not Ranked";}else{echo $slayer[0];} echo "</td>"; echo "<td>".$slayer[1]."</td>"; echo "<td>".$slayer[2]."</td>"; echo "<td>"; if ($slayer[2] == $slayer1[2]){ echo "<img src='images/equal.png' />"; } elseif ($slayer[2] <= $slayer1[2]){ echo "<img src='images/downArrow.png' />"; } elseif ($slayer[2] >= $slayer1[2]){ echo "<img src='images/upArrow.png' />"; } echo "</td>"; echo "<td><b>Slayer</b></td>"; echo "<td>";if($slayer1[0]<=-1){echo "Not Ranked";}else{echo $slayer1[0];} echo "</td>"; echo "<td>".$slayer1[1]."</td>"; echo "<td>".$slayer1[2]."</td>"; echo "</tr>"; echo "<tr>"; echo "<td><b>Farming</b></td>"; echo "<td>";if($farming[0]<=-1){echo "Not Ranked";}else{echo $farming[0];} echo "</td>"; echo "<td>".$farming[1]."</td>"; echo "<td>".$farming[2]."</td>"; echo "<td>"; if ($farming[2] == $farming1[2]){ echo "<img src='images/equal.png' />"; } elseif ($farming[2] <= $farming1[2]){ echo "<img src='images/downArrow.png' />"; } elseif ($farming[2] >= $farming1[2]){ echo "<img src='images/upArrow.png' />"; } echo "</td>"; echo "<td><b>Farming</b></td>"; echo "<td>";if($farming1[0]<=-1){echo "Not Ranked";}else{echo $farming[0];} echo "</td>"; echo "<td>".$farming1[1]."</td>"; echo "<td>".$farming1[2]."</td>"; echo "</tr>"; echo "<tr>"; echo "<td><b>Runecrafting</b></td>"; echo "<td>";if($runecraft[0]<=-1){echo "Not Ranked";}else{echo $runecraft[0];} echo "</td>"; echo "<td>".$runecraft[1]."</td>"; echo "<td>".$runecraft[2]."</td>"; echo "<td>"; if ($runecraft[2] == $runecraft1[2]){ echo "<img src='images/equal.png' />"; } elseif ($runecraft[2] <= $runecraft1[2]){ echo "<img src='images/downArrow.png' />"; } elseif ($runecraft[2] >= $runecraft1[2]){ echo "<img src='images/upArrow.png' />"; } echo "</td>"; echo "<td><b>Runecrafting</b></td>"; echo "<td>";if($runecraft1[0]<=-1){echo "Not Ranked";}else{echo $runecraft1[0];} echo "</td>"; echo "<td>".$runecraft1[1]."</td>"; echo "<td>".$runecraft1[2]."</td>"; echo "</tr>"; echo "<tr>"; echo "<td><b>Hunter</b></td>"; echo "<td>";if($hunter[0]<=-1){echo "Not Ranked";}else{echo $hunter[0];} echo "</td>"; echo "<td>".$hunter[1]."</td>"; echo "<td>".$hunter[2]."</td>"; echo "<td>"; if ($hunter[2] == $hunter1[2]){ echo "<img src='images/equal.png' />"; } elseif ($hunter[2] <= $hunter1[2]){ echo "<img src='images/downArrow.png' />"; } elseif ($hunter[2] >= $hunter1[2]){ echo "<img src='images/upArrow.png' />"; } echo "</td>"; echo "<td><b>Hunter</b></td>"; echo "<td>";if($hunter1[0]<=-1){echo "Not Ranked";}else{echo $hunter1[0];} echo "</td>"; echo "<td>".$hunter1[1]."</td>"; echo "<td>".$hunter1[2]."</td>"; echo "</tr>"; echo "<tr>"; echo "<td><b>Construction</b></td>"; echo "<td>";if($construction[0]<=-1){echo "Not Ranked";}else{echo $construction[0];} echo "</td>"; echo "<td>".$construction[1]."</td>"; echo "<td>".$construction[2]."</td>"; echo "<td>"; if ($construction[2] == $construction1[2]){ echo "<img src='images/equal.png' />"; } elseif ($construction[2] <= $construction1[2]){ echo "<img src='images/downArrow.png' />"; } elseif ($construction[2] .= $construction1[2]){ echo "<img src='images/upArrow.png' />"; } echo "</td>"; echo "<td><b>Construction</b></td>"; echo "<td>";if($construction1[0]<=-1){echo "Not Ranked";}else{echo $construction1[0];} echo "</td>"; echo "<td>".$construction1[1]."</td>"; echo "<td>".$construction1[2]."</td>"; echo "</tr>"; echo "<tr>"; echo "<td><b>Summoning</b></td>"; echo "<td>";if($summoning[0]<=-1){echo "Not Ranked";}else{echo $summoning[0];} echo "</td>"; echo "<td>".$summoning[1]."</td>"; echo "<td>".$summoning[2]."</td>"; echo "<td>"; if ($summoning[2] == $summoning1[2]){ echo "<img src='images/equal.png' />"; } elseif ($summoning[2] <= $summoning1[2]){ echo "<img src='images/downArrow.png' />"; } elseif ($summoning[2] >= $summoning1[2]){ echo "<img src='images/upArrow.png' />"; } echo "</td>"; echo "<td><b>Summoning</b></td>"; echo "<td>";if($summoning1[0]<=-1){echo "Not Ranked";}else{echo $summoning[0];} echo "</td>"; echo "<td>".$summoning1[1]."</td>"; echo "<td>".$summoning1[2]."</td>"; echo "</tr>"; echo "<tr>"; echo "<td><b>Dungeoneering</b></td>"; echo "<td>";if($dungeoneering[0]<=-1){echo "Not Ranked";}else{echo $dungeoneering[0];} echo "</td>"; echo "<td>".$dungeoneering[1]."</td>"; echo "<td>".$dungeoneering[2]."</td>"; echo "<td>"; if ($dungeoneering[2] == $dungeoneering1[2]){ echo "<img src='images/equal.png' />"; } elseif ($dungeoneering[2] <= $dungeoneering1[2]){ echo "<img src='images/downArrow.png' />"; } elseif ($dungeoneering[2] >= $dungeoneering1[2]){ echo "<img src='images/upArrow.png' />"; } echo "</td>"; echo "<td><b>Dungeoneering</b></td>"; echo "<td>";if($dungeoneering1[0]<=-1){echo "Not Ranked";}else{echo $dungeoneering1[0];} echo "</td>"; echo "<td>".$dungeoneering1[1]."</td>"; echo "<td>".$dungeoneering1[2]."</td>"; echo "</tr>"; echo "</table>"; ?> How would I go about fixing this error? Quote Link to comment https://forums.phpfreaks.com/topic/249584-file_get_contents/ Share on other sites More sharing options...
PFMaBiSmAd Posted October 22, 2011 Share Posted October 22, 2011 Does that site have a separate method of testing if a user exists? If so, you should first check if the user is valid before trying to retrieve the data for that user. If not, file_get_contents returns a FALSE value on failure. You need to do two things - 1) display_errors should be set to OFF on a live server, so that php detected errors are not displayed. 2) Your logic should test if a FALSE value is returned and output an appropriate error message, such as 'Could not retrieve data for the username.' Quote Link to comment https://forums.phpfreaks.com/topic/249584-file_get_contents/#findComment-1281338 Share on other sites More sharing options...
PFMaBiSmAd Posted October 22, 2011 Share Posted October 22, 2011 You also have far far too much code and variables. The following is equivalent to the original code you posted - <?php $user = "S U O M I"; $user1 = "Tezz"; if(isset($_GET['user'])) { if(!empty($_GET['user'])) { $user = $_GET['user']; } } if(isset($_GET['user1'])) { if(!empty($_GET['user1'])) { $user1 = $_GET['user1']; } } //Skill Grabs $order = array("Overall", "Attack", "Defence", "Strength", "Hitpoints", "Ranged", "Prayer", "Magic", "Cooking", "Woodcutting", "Fletching", "Fishing", "Firemaking", "Crafting", "Smithing", "Mining", "Herblore", "Agility", "Thieving", "Slayer", "Farming", "Runecraft", "Hunter", "Construction", "Summoning", "Dungeoneering"); $get = file_get_contents("http://hiscore.runescape.com/index_lite.ws?player=$user"); $get = explode("\n", $get); foreach($get as $key => $value){ $get[$key] = explode(',',$value); } $get1 = file_get_contents("http://hiscore.runescape.com/index_lite.ws?player=$user1"); $get1 = explode("\n", $get1); foreach($get1 as $key => $value){ $get1[$key] = explode(',',$value); } echo "<table border='1' cellpadding='5'>"; echo "<tr>"; echo "<td colspan='4'><b><center>".strtoupper($user)."</center></b></td>"; echo "<td></td>"; echo "<td colspan='4'><b><center>".strtoupper($user1)."</center></b></td>"; echo "</tr>"; echo "<tr>"; echo "<td><b>Skills</b></td>"; echo "<td><b>Rank</b></td>"; echo "<td><b>Level</b></td>"; echo "<td><b>XP</b></td>"; echo "<td></td>"; echo "<td><b>Skills</b></td>"; echo "<td><b>Rank</b></td>"; echo "<td><b>Level</b></td>"; echo "<td><b>XP</b></td>"; echo "</tr>"; // loop over values foreach ($order as $key => $value) // 0-26, Overall-Dungeoneering { echo "<tr>"; echo "<td><b>$value</b></td>"; echo "<td>";if($get[$key][0]<=-1){echo "Not Ranked";}else{echo $get[$key][0];} echo "</td>"; echo "<td>".$get[$key][1]."</td>"; echo "<td>".$get[$key][2]."</td>"; echo "<td>"; if ($get[$key][2] == $get1[$key][2]){ echo "<img src='images/equal.png' />"; } elseif ($get[$key][2] <= $get1[$key][2]){ echo "<img src='images/downArrow.png' />"; } elseif ($get[$key][2] >= $get1[$key][2]){ echo "<img src='images/upArrow.png' />"; } echo "</td>"; echo "<td><b>$value</b></td>"; echo "<td>";if($get1[$key][0]<=-1){echo "Not Ranked";}else{echo $get1[$key][0];} echo "</td>"; echo "<td>".$get1[$key][1]."</td>"; echo "<td>".$get1[$key][2]."</td>"; echo "</tr>"; } echo "</table>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/249584-file_get_contents/#findComment-1281345 Share on other sites More sharing options...
Dusaro Posted October 22, 2011 Author Share Posted October 22, 2011 2) Your logic should test if a FALSE value is returned and output an appropriate error message, such as 'Could not retrieve data for the username.' Sorry, but i'm not sure how this would be written... Quote Link to comment https://forums.phpfreaks.com/topic/249584-file_get_contents/#findComment-1281458 Share on other sites More sharing options...
PFMaBiSmAd Posted October 23, 2011 Share Posted October 23, 2011 <?php if($get = file_get_contents("http://hiscore.runescape.com/index_lite.ws?player=$user")){ // file_get_contents returned data (a string that is not empty, not null, or not a '0' value is TRUE) // your code to use the data that was returned goes here... } else { // file_get_contents returned a FALSE value //your code for when an error occurred goes here... } In every programming language, after you learn variables and assigning values/strings to variables, you learn constructs like conditional statements and loops. I recommend going through a basic php book or some basic php tutorials so that you can efficiently write simple code yourself. Quote Link to comment https://forums.phpfreaks.com/topic/249584-file_get_contents/#findComment-1281511 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.