Jump to content

[SOLVED] I can telnet but not via fsockopen


Yesideez

Recommended Posts

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?

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.