I am an asp programmer. This is the first time I have written a php program.
Copy codeThe Code is as follows:
<? Php
$ Ip2id = round (rand (600000,255 0000)/10000); // The first method is directly generated.
$ Ip3id = round (rand (600000,255 0000)/10000 );
$ Ip4id = round (rand (600000,255 0000)/10000 );
// The second method is as follows:
$ Arr_1 = array ("218", "218", "66", "66", "218", "218", "60", "60 ", "202", "204", "66", "66", "66", "59", "61", "60", "222", "221 ", "66", "59", "60", "60", "66", "218", "218", "62", "63", "64 ", "66", "66", "122", "211 ");
$ Randarr = mt_rand (0, count ($ arr_1)-1 );
$ Ip1id = $ arr_1 [$ randarr];
Echo $ ip1id;
Echo ".";
Echo $ ip2id;
Echo ".";
Echo $ ip3id;
Echo ".";
Echo $ ip4id;
?>
The sample output is 218.28.131.182.
The feature of this program is that the first field of the generated ip address is within the specified range, and several are common Chinese number segments. That is to say, most of the generated ip addresses are in China.
Core code:
Copy codeThe Code is as follows:
<? Php
$ Arr_1 = array ("http: // 66.249.89.99", "http: // 66.249.89.104", "http: // 74.125.71.105 ");
$ Randarr = mt_rand (0, count ($ arr_1)-1 );
$ Gip = $ arr_1 [$ randarr];
Echo $ gip. "$ randarr ";
?>