prime Posted August 10, 2007 Share Posted August 10, 2007 Ok I'm trying to put together a stats lookup utility for a game I play here thecode I have so far <?php $name = $_post['rsname']; $url = sprintf("http://hiscore.runescape.com/index_lite.ws?player=$name") ; $fp = @fopen ($url, 'r') or die ('<font color="red"><center>ERROR</font><br/><font color="white">cannot access highscores</center></font>'); $read = fgetcsv ($fp); fclose ($fp); echo "$read"; ?> already I just keep getting that error message that I defined and I'm not sure why Link to comment https://forums.phpfreaks.com/topic/64198-solved-fp-fuction/ Share on other sites More sharing options...
btherl Posted August 10, 2007 Share Posted August 10, 2007 The url you are trying to access gives 404 not found for me. Link to comment https://forums.phpfreaks.com/topic/64198-solved-fp-fuction/#findComment-320047 Share on other sites More sharing options...
prime Posted August 10, 2007 Author Share Posted August 10, 2007 well the way I have it running is a name is imputed from a form through $_post['rsname'] which I am then assigning to the variable $name and then applying to the end of the url to get the proper url for that highscores link. the only problem is the url done like this doesn't seem to work, and im not sure why. but if you paste the following into your browser it works fine: http://hiscore.runescape.com/index_lite.ws?player=primefalcon Link to comment https://forums.phpfreaks.com/topic/64198-solved-fp-fuction/#findComment-320052 Share on other sites More sharing options...
trq Posted August 10, 2007 Share Posted August 10, 2007 Try removing the @ (and the or die()) so we might actually see what the real error is. You may not have url_wrappers enabled. Link to comment https://forums.phpfreaks.com/topic/64198-solved-fp-fuction/#findComment-320055 Share on other sites More sharing options...
btherl Posted August 10, 2007 Share Posted August 10, 2007 Try this: <?php $name = $_POST['rsname']; $url = "http://hiscore.runescape.com/index_lite.ws?player=$name" ; $fp = @fopen ($url, 'r') or die ('<font color="red"><center>ERROR</font><br/><font color="white">cannot access highscores</center></font>'); while ($read = fgetcsv ($fp, 1024)) { print_r($read); } fclose($fp); ?> Note that the second argument to fgetcsv() only became optional in PHP5. Link to comment https://forums.phpfreaks.com/topic/64198-solved-fp-fuction/#findComment-320056 Share on other sites More sharing options...
prime Posted August 10, 2007 Author Share Posted August 10, 2007 Thanks! that works :-D Array ( [0] => 4775 [1] => 1936 [2] => 103586355 ) Array ( [0] => 27305 [1] => 95 [2] => 8837311 ) Array ( [0] => 23061 [1] => 91 [2] => 6247927 ) Array ( [0] => 47787 [1] => 91 [2] => 6245101 ) Array ( [0] => 27968 [1] => 94 [2] => 8080910 ) Array ( [0] => 49940 [1] => 83 [2] => 2830705 ) Array ( [0] => 15891 [1] => 76 [2] => 1345800 ) Array ( [0] => 23526 [1] => 92 [2] => 6845920 ) Array ( [0] => 4178 [1] => 99 [2] => 14080622 ) Array ( [0] => 15252 [1] => 93 [2] => 7400728 ) Array ( [0] => 15273 [1] => 99 [2] => 13080429 ) Array ( [0] => 15169 [1] => 88 [2] => 4622427 ) Array ( [0] => 5260 [1] => 92 [2] => 6755864 ) Array ( [0] => 14915 [1] => 79 [2] => 1922283 ) Array ( [0] => 25873 [1] => 74 [2] => 1107959 ) Array ( [0] => 40936 [1] => 79 [2] => 1812284 ) Array ( [0] => 13325 [1] => 74 [2] => 1124492 ) Array ( [0] => 11309 [1] => 73 [2] => 1016080 ) Array ( [0] => 13536 [1] => 78 [2] => 1647912 ) Array ( [0] => 10506 [1] => 85 [2] => 3282252 ) Array ( [0] => 7759 [1] => 78 [2] => 1682360 ) Array ( [0] => 6533 [1] => 77 [2] => 1552504 ) Array ( [0] => 11833 [1] => 73 [2] => 1044506 ) Array ( [0] => 6727 [1] => 73 [2] => 1019979 ) thank you! that works great! now I just need to actualy get that stop displaying and work out how to do soemthing like attack 76 - 1335- 354 crafting same as above but with relative value and so on Link to comment https://forums.phpfreaks.com/topic/64198-solved-fp-fuction/#findComment-320060 Share on other sites More sharing options...
prime Posted August 10, 2007 Author Share Posted August 10, 2007 not sure why that qouted..... sorry for double post Link to comment https://forums.phpfreaks.com/topic/64198-solved-fp-fuction/#findComment-320085 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.