php file reader? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: php file reader? (
/showthread.php?tid=243433)
php file reader? -
sciman001 - 23.03.2011
Is it possible to make a php page that reads a file (tlog.ini) and writes the data there on to the page. If so, how? I need it to do this every time the file changes. I want this for a way to see the chat in my server on the site. PLEASE HELP!!!
Re: php file reader? -
Steven82 - 23.03.2011
Why not just use MySQL??
Re: php file reader? - XFlawless - 23.03.2011
it's possible
check this
Re: php file reader? -
SuperS82 - 23.03.2011
PHP код:
<?php
$file = "/folder/tlog.ini"; //sets the files location
$f = fopen($file, "r"); //opens the file for reading only
while ( $line = fgets($f, 1000) ) { //loops through the files contents
print $line; //prints the contents to the browser
}
?>
Let me know if this is what you wanted. If not, I can help you out with what your going for. I think I know what your trying it accomplish.
Also @ Steven : He asked for PHP coding not MySQL! Obviously he has his script setup to store all chat into a file (not MySQL) and would like to use that file to display its contents into a web page for live viewing for people that arent in game.
Nice idea, makes your website interactive with your server!
Re: php file reader? -
Steven82 - 23.03.2011
Quote:
Originally Posted by SuperS82
<?php
$file = "/folder/tlog.ini"; //sets the files location
$f = fopen($file, "r"); //opens the file for reading only
while ( $line = fgets($f, 1000) ) { //specifies the line to read
print $line; //prints the lines contents to the browser
}
?>
|
Off Topic:
There is
brackets
Re: php file reader? -
sciman001 - 23.03.2011
Quote:
Originally Posted by SuperS82
PHP код:
<?php
$file = "/folder/tlog.ini"; //sets the files location
$f = fopen($file, "r"); //opens the file for reading only
while ( $line = fgets($f, 1000) ) { //loops through the files contents
print $line; //prints the contents to the browser
}
?>
Let me know if this is what you wanted. If not, I can help you out with what your going for. I think I know what your trying it accomplish.
Also @ Steven : He asked for PHP coding not MySQL! Obviously he has his script setup to store all chat into a file (not MySQL) and would like to use that file to display its contents into a web page for live viewing for people that arent in game.
Nice idea, makes your website interactive with your server!
|
Ok, i got it to sort of work, but it doesnt automatically update. how do i fix this? also, can i have it on a remote pc or does it have to be on the same coputer?
Re: php file reader? -
Mike Garber - 23.03.2011
Quote:
Originally Posted by sciman001
Ok, i got it to sort of work, but it doesnt automatically update. how do i fix this? also, can i have it on a remote pc or does it have to be on the same coputer?
|
In that case, it has to be on a webserver. Or you can install
http://www.wampserver.com/en/
Re: php file reader? -
sciman001 - 23.03.2011
Quote:
Originally Posted by Mike Garber
|
Ok.. it works but u hav 2 predd f5 to get it to load... how i fix that?
Re: php file reader? -
sciman001 - 23.03.2011
anyone??
Re: php file reader? -
sciman001 - 23.03.2011
PLEASE SOMEONE!