Originally Posted by
Chunkingz
I am looking to create sumfin like dis but using PHP, where do u get ur ips from? Cos dats my problem
Here's a basic snippet I made just looking up how to form arrays, generate random numbers, and concatenating the array result using a simple while loop for the individual numbers being generated.
Code:
<?php
$x = 0;
$myIP = [];
while($x != 4) {
$a = rand(0, 255);
$myIP[$x] = $a;
$x++;
}
$finalIP = implode(".", $myIP);
echo $finalIP;
?>
Here's a "Working" sample
Code:
<?php
while(0 != 1) {
$x = 0;
$myIP = [];
while($x != 4) {
$a = rand(0, 255);
$myIP[$x] = $a;
$x++;
}
$finalIP = implode(".", $myIP);
echo $finalIP;
echo "\n";
$fp = fSockOpen($finalIP, 80, $errno, $errstr, 1);
if($fp) {
$status=0;
echo "Works!\n";
fclose($fp);
} else {
$status=1;
echo "Not working!\n";
}
}
?>
Just an idea to get you started, even though I personally wouldn't use PHP especially with huge nested loops like what I've done in python. It's just too slow and easy to have memory leaking issues