Skip to content

Instantly share code, notes, and snippets.

@AbhishekGhosh
Created February 27, 2016 22:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AbhishekGhosh/725e743512e2d54fb471 to your computer and use it in GitHub Desktop.
Save AbhishekGhosh/725e743512e2d54fb471 to your computer and use it in GitHub Desktop.
Check Port 25, 465, 587 whether open via PHP
<?php
// 5 is the timeout in seconds
// 25 is port, other ports you may check are 465 and 587
$fp = fsockopen('127.0.0.1', 25, $errno, $errstr, 5);
if (!$fp) {
} else {
fclose($fp);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment