Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- checkport_range("www.google.com", 1, 255);
- function checkport($host, $port_array) {
- foreach ( $port_array as $port ) {
- if(($port % 1) != 0 || $port > 65535) die ("Invalid port number");
- $fp = @fsockopen($host, $port, $errno, $errstr, 2);
- echo $host.':'.$i.' = ';
- if ( !$fp ) {
- echo "Port close\n";
- } else {
- echo "Port open\n";
- }
- }
- }
- function checkport_range($host, $start_range, $end_range) {
- for ( $i = $start_range; $i < $end_range; $i++ ) {
- if(($i % 1) != 0 || $i > 65535) die ("Invalid port number");
- $fp = @fsockopen($host, $i, $errno, $errstr, 2);
- echo $host.':'.$i.' = ';
- if ( !$fp ) {
- echo "Port close\n";
- } else {
- echo "Port open\n";
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment