View Single Post
  #1  
Old 08-05-2008, 10:38 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default Unable to Connect Via Telnet with PHP

I am trying to get some tools working for my server that need direct telnet access to the server on port 9000 to use them. I have tried all I can think of to get this working. My PHP skills are pretty weak, so maybe I am doing something wrong. The only other thing I can think of is that the web hosting I am using to connect to the server remotely might be blocking port 9000. Though, I don't know why it would block that port.

Once I can verify that the connection is able to work, I can get the rest setup without much difficulty (I hope). For now, all I am trying to do is verify that I can get connected to the server, so this is a pretty basic file.

index.php
Code:
<?php

$Server='my.dyndns.com';  //of course my real dyndns address has been replaced here for the post
$Port='9000';
$user='username'; //username of my GM account on the server
$pass='password'; //password that I have in my accounts table for my GM account

$url = 'http://stormhavenserver.com/'; //this will eventually point back to the tool

$fp = fsockopen($Server, $Port);
$end = "<a href=$url>Go back to the Tool</a>";

function fConnect($fp,$Server,$Port,$user,$pass){
	if(!$fp){
	echo ("Error connecting host...");
	}else{
		fputs ($fp, "$user\r");
		echo("Login Accepted\r<br>");
		usleep(125000);   
      		fputs ($fp, "$pass\r");
		usleep(125000);
		echo("Password Accepted\r<br>");
	}
}

?>
Here is the error I get when I try to go to index.php (of course my.dns.com in this output was replaced so it doesn't show my real address):
Code:
Warning: fsockopen() [function.fsockopen]: unable to connect to my.dyndns.com:9000 (Connection timed out) in /home/stormhav/public_html/tools/status/index.php on line 3
()
If anyone has any ideas what could be wrong, I would love to get this working. I have been messing with it for a few hours and just can't figure it out :(
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote