PDA

View Full Version : IP + Port Checker....


lil_drummaboy
04-24-2003, 01:45 AM
Hey all,

I'm looking for a script that can check a desired ip and port and display if it is active or not. So, when you goto the page it will just say "The server, 0.0.0.0:0 is active (or not active)". i am having trouble explaining this.........so nothing fancy just want it to say if the port on that IP is active.

PS. I know very little about PHP so if you can solve this please be detailed

Ökii
04-24-2003, 09:21 AM
personally I'd advise learning a very lot about PHP before doing any socket programming for a number of reasons.

to port scan, you're going to want a script to open a socket to the client ip:port and set a listener for the return, which will mean you'll have to turn of your max_execution_time or raise it stupidly high.
this is obviously not the sort of thing you would do for a publicly accessible page at page load, so you need a cron job (quite simple - worth learning) activating it and would therefore need to suppress output (another thing to learn - buffering) and direct that to a standard txt or database.

once you are satisfied that you are competent at manipulating your .ini settings, scheduling crons and buffering output, you could start on the port scanner.

subnote: if you are just seeking to test if a server is responding, why not just fopen() a file on it and check the return - much simpler, faster and safer.