Here is a simple Port scanner written in PHP. It checks if a port is accessible by trying to connect to it using PHP's fsockopen function. The first foreach loop goes through the port numbers in the $ports array trying to connect to each one using the fsockopen function
This post first appeared on CodeHill - Web Development Applications And Articl, please read the originial post: here