Digital PCI Fast Hosting & Custom Design
Hosting Development
Custom Web Development WordPress Development SEO Services
Domains Dedicated Servers
Virtual Private Servers Semi-Dedicated Server Dedicated Servers
Member Login Tools
Version Control System Code Unminifier DNS Lookup Digital PCI Radio
About
About Digital PCI Data Centers Contact Us
Digital PCI Logo
Hosting Development
Custom Web Development WordPress Development SEO Services
Domains Dedicated Servers
Virtual Private Servers Semi-Dedicated Server Dedicated Servers
Tools
Version Control System Code Unminifier DNS Lookup Digital PCI Radio
About
About Digital PCI Data Centers Contact Us

PHP Open Port Tester

November 26th, 2018   /   By Andrew Currie

Learn more about PHP Open Port Tester

One of my favorite network tool websites is YouGetSignal.com and recently I was using their open port tester to ensure my port forwarding rules were working. I started wondering how difficult it would be to setup an open port tester using PHP and turns out, it was really easy.

I’d like to share my basic working example below in case anyone has an interest or use for this as well. I did this using two files: portcheck.html and ports.php the port checker file is just a simple form that asks for the domain or host you want to test and then the port number you are testing. The action on this form points to the ports script which receives this request and then tests whether or not the port is open using the fsockopen PHP function.

Below is the source of portcheck.html:

Below is the source of ports.php:

Save both portcheck.html and ports.php in the same folder then visit portcheck.html in your browser. You should get a form that’s asking for a domain/host and a port number as shown in the screenshot below:

PHP Open Port Tester

If you entered in google.com and port 80 then click submit, the ports script will test connectivity using fsockopen on google.com and port 80 then return the results as shown below:

PHP Open Port Tester Results

Digital PCI What is Digital PCI? Website Development Digital PCI Radio
Tools Version Control System Code Unminifier DNS Lookup
QuickLinks Member Login Contact Us

© 2022