I'm used to using Fiddler to send the request header, because composer is so useful. But sometimes loops 1M times, you can not click 1M times. Of course Ab,tsung can be achieved. Sometimes program control is more convenient, so write these: for later use (some not perfect)
<?php //http://api.k780.com:88/?app=weather.today&weaid=1&appkey=10003&sign= B59bc3ef6191eb9f747dd4e83c99f2a4&format=xml $startTime= Microtime (true); for($i=1;$i< -;$i++ ){if($i%1==0){$j=$i%Ten;Echo "0"; }$host="Www.cnblogs.com";$handle= Fsockopen ($host, the,$errorCode,$ERRORMSG,Ten);if(!$handle){Echo "Error";return; }//Use an array to construct a request header $HEADERARR=Array( );$header="get/jiaxu/p/4599675.html http/1.1\r\n";$header.="host:www.cnblogs.com\r\n";$header.="user-agent:mozilla/5.0 (Windows NT 6.1; rv:38.0) gecko/20100101 firefox/38.0\r\n ";$header.="accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n";$header.="accept-language:zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3\r\n";$header.="Cookie: _ga=ga1.3.80880395.1436242846\r\n";$header.="connection:keep-alive\r\n";$header.="If-modified-since:tue, 06:05:{$i} gmt\r\n";$header.="x-forwarded-for:192.168.2. {$j}02\r\n\r\n "; Fwrite$handle,$header);$line=""; while(!feof ($handle)){$line. = Fgets ($handle); }//echo $line;Fclose$handle); }$endTime= Microtime (true);Echo $errorCode,":";$total=$endTime-$startTime;Echo $total;?>
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Source-php-request-1