porko2004 Posted February 3, 2009 Share Posted February 3, 2009 hi guys i got this code and i was wondering how i make it connect to an ip which is not the web server. please help <center> <font color="#FFFFFF"><b>Online Players:</b></font> <font color="#FFFF00"><b> <?php echo (exec('netstat -a -n |find "5816" |find "ESTABLISHED" /c')); ?> </b><br /> </font></center> Quote Link to comment Share on other sites More sharing options...
ratcateme Posted February 3, 2009 Share Posted February 3, 2009 if you want to make a connection to a server look at sockets if you want the entire output of that command try: <?php exec('netstat -a -n |find "5816" |find "ESTABLISHED" /c',$output); echo implode("<br>",$output) ?> Scott. Quote Link to comment Share on other sites More sharing options...
genericnumber1 Posted February 3, 2009 Share Posted February 3, 2009 http://us2.php.net/fsockopen is what rat was referring to. Quote Link to comment Share on other sites More sharing options...
porko2004 Posted February 3, 2009 Author Share Posted February 3, 2009 ok but thats not what i mean. Example. My webserver is another ip to where it is ment to get details. EG. webserver 58.195.56.156 Eg server 121.45.144.125 i wont it to get info from server not webserver and clue how to do that Quote Link to comment Share on other sites More sharing options...
ratcateme Posted February 3, 2009 Share Posted February 3, 2009 you could install a basic webserver application on the second server and run a script like <?php exec('netstat -a -n |find "5816" |find "ESTABLISHED" /c',$output); echo implode("<br>",$output) ?> on it then get it using curl and put it in your main page on your web server Scott. Quote Link to comment Share on other sites More sharing options...
porko2004 Posted February 3, 2009 Author Share Posted February 3, 2009 so there is not other way casue the server cant host a website Quote Link to comment Share on other sites More sharing options...
ratcateme Posted February 3, 2009 Share Posted February 3, 2009 umm well not understanding much about what you are trying to do you are left with what genericnumber said and you will have to use sockets to connect to it some how. Scott. Quote Link to comment Share on other sites More sharing options...
porko2004 Posted February 3, 2009 Author Share Posted February 3, 2009 this code is located on the webserver and i wont it to look at the server not webserver Quote Link to comment Share on other sites More sharing options...
ratcateme Posted February 3, 2009 Share Posted February 3, 2009 yea well you need sockets to connect to the other server from your webserver. Scott. Quote Link to comment Share on other sites More sharing options...
porko2004 Posted February 3, 2009 Author Share Posted February 3, 2009 yes got any clue how Quote Link to comment Share on other sites More sharing options...
ratcateme Posted February 3, 2009 Share Posted February 3, 2009 is this for a game server? i have never tried to get info from a game server before so can't really be of any help there might be worth a try on some forums about the game server you are contacting Scott. Quote Link to comment Share on other sites More sharing options...
porko2004 Posted February 3, 2009 Author Share Posted February 3, 2009 ok ty Quote Link to comment 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.