Yesideez Posted June 9, 2008 Share Posted June 9, 2008 Hi, trying to write a remote admin suite for my Battlefield 2 clan admin so they can issue commands when on a PC that doesn't have BF2 installed and although we can connect to the game server via telnet my PHP code always times out. The original code I've been using was given away by the coder and many have used it no problems but I can't - fsockopen times out where telnet connects immediately. Here's my most basic code: <?php ob_start(); if ($tmp=fsockopen('8.6.**.**',****,$errno,$errstr,5)) { while (!feof($tmp)) { $txt=fread($tmp); str_replace("\n",'*N',$txt); str_replace("\r",'*R',$txt); str_replace("\t",'*T',$txt); echo $txt.'<br />'; } fclose($tmp); } else { echo 'No connection'; } ?> I've replaced part of the server IP and the port number with stars. All I get on the screen is "No connection" when I should be getting something like this: ### Battlefield 2 ModManager Rcon v3.5. Anyone have any idea where my problem could be? Quote Link to comment https://forums.phpfreaks.com/topic/109386-solved-i-can-telnet-but-not-via-fsockopen/ Share on other sites More sharing options...
MadTechie Posted June 9, 2008 Share Posted June 9, 2008 try changing the 5 seconds timeout to 15 or 30 or even 90 seconds if ($tmp=fsockopen('8.6.**.**',****,$errno,$errstr,30)) { Quote Link to comment https://forums.phpfreaks.com/topic/109386-solved-i-can-telnet-but-not-via-fsockopen/#findComment-561054 Share on other sites More sharing options...
Yesideez Posted June 9, 2008 Author Share Posted June 9, 2008 Found the root of the problem. This lies with the hosting company blocking lookup requests, they've been contacted to see if they can change this for me. Quote Link to comment https://forums.phpfreaks.com/topic/109386-solved-i-can-telnet-but-not-via-fsockopen/#findComment-561584 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.