Source-php-request-1

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.