i have a script that allows me to port my in-game chat from Call Of Duty 4 to a small window using php script live from my gaming server so my members and visitors can see in-game chat live from my site.
Only problem is my server is locked by ftp (tcadmin so no way of direct url for file) so i want a way to read the mp_games.log file in the directory
i think only way is to connect through ftp i guess but it’ll need to auto-login
the script is: ( this is only a part of the script where im having the problem )
<?php
$maxMessages = 40;
$messageArr = array();
foreach(file('file:///home/serverexample/main/games_mp.log') AS $value) {
if(strstr($value,'say;')) {
$messageArr[]=$value;
}
}
what i need help with is to make the foreach go to the ftp in my site into a specific path where it can read the game_mp.log ..
i was thinking something similar to: ftp://user:pass@ftp.domain.com/serverexample/main/games_mp.log
Can you tell me how to modify the script in order to possibly download it onto a dir in local address but it’ll need to be constantly downloading which im afraid might cause lag.
The other way i was thinking of, if possible is to read directly the game_mp.log file
games_mp.log is readable as txt .. and is always being updated by server .. any way to make the foreach(file replaced by ftp so it takes directly the info from the ftp server ?
preferably being able to male the script read the file without having to download it ..
and if there is no other way but downloading it can you guide me through that as well ?
Many thanks hope i made myself clear of what i need
You can
loginanddownloadthe file with the FTP functions of PHP, look at the list of manuals http://www.php.net/ftpAn alternative (not recommend) is WGET: http://www.cyberciti.biz/faq/wget-command-with-username-password/