The below given php script scans open ports on target server. There are mainly two functions are used for scanning :
fsockopen() : The fsockopen() function is used to open socket connection with given hostname and port. Syntax :
fsockopen(hostname, port, errNo, errStr, timeout);
getservbyport() : The getservbyport() function is used to get the service name which corresponds to supplied port and protocol. Syntax : getservbyport(portNumber, ProtocolName);



