Jump to content

[SOLVED] fp fuction


prime

Recommended Posts

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
Share on other sites

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
Share on other sites

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.