PHP one sentence classic Code classic business solution 1. batch random simulation of customer IP addresses in PHP collection
Echo join ('.', array (mt_rand (0,255), mt_rand (0,255), mt_rand (0,255), mt_rand (0,255 )));
2. when Mysql is inserted, one inser inserts big data in batches efficiently.
$ Db-> query ('Insert INTO 'mytable' ('address') VALUES '. join (',', array_map (function ($ ip, $ port) {return '("'. ($ ip. ':'. $ port ). '")';}, $ ipArray [0], $ ipArray [1]). ';'); note that the data format of your $ ipArray is: $ ipArray = array ('127. 0.0.1 ', '2017. 168.1.1 '), array ('80', '123 '));
3. during the collection, do not allow the program to collect the target site too frequently (to prevent the target site from being detected or accessed too frequently). we can take the program rest method:
Usleep (mt_rand (1000,100 0000); // The unit is subtle