zoukankan      html  css  js  c++  java
  • erlang httpc

    1,set proxy 10.100.1.76 :8888

     httpc:set_options([{proxy,{{"10.100.1.76",8888},[]}}]).

    2,set cookie enabled

    > httpc:set_options([{cookies,enabled}]).
    ok

    3,login and create team

     1 application:start(inets).
     2 httpc:set_options([{cookies,enabled}]).
     3 httpc:request("http://1.1.13.4/user/login").
     4 httpc:request(post,{"post url --remember add v2",[],"application/x-www-form-urlencoded", lists:concat(["post string curl use -d"])},[],[]).
     5 httpc:request(post,{"post url",[],"application/x-www-form-urlencoded", lists:concat(["post string curl use -d "])},[],[]).
     6 
     7 httpc:which_cookies(). 
     8 [{session_cookies,[{http_cookie,"1.1.13.4",true,
     9                                 "JSESSIONID","aaa6JQwGALt04aTzzID1u",undefined,session,"/",
    10                                 false,false,"0"},
    11                    {http_cookie,"1.1.13.4",true,"X-XX-SESS-ID",   %% u know what XX is
    12                                 "f9vl028l6seblbh7v9i03ico02",undefined,session,"/",false,
    13                                 false,"0"},
    14                    {http_cookie,"1.1.13.4",true,"language","zh",undefined,
    15                                 session,"/",false,false,"0"}]}]

    4,e.z test case

     1 File Edit Options Buffers Tools Help
     2 -module(tt).
     3 -export([max/1]).
     4 
     5 
     6 max(N)->
     7 Max=erlang:system_info(process_limit),
     8 io:format("Maximum allowd processes:~p~n",[Max]),
     9 statistics(runtime),
    10 statistics(wall_clock),
    11 L=for(1,N,fun()-> spawn(fun()->wait() end) end),
    12 {_,Time1}=statistics(runtime),
    13 {_,Time2}=statistics(wall_clock),
    14 lists:foreach(fun(Pid)->Pid ! die end, L),
    15 U1=Time1 * 1000 / N ,
    16 U2=Time2 * 1000 / N ,
    17 io:format("Process spawn time=~p(~p) microseconds~n",
    18 [U1,U2]).
    19 
    20 
    21 wait()->
    22         receive
    23                 die -> httpc:request("http://192.168.1.51")
    24         end.
    25 for(N,N,F)->[F()];
    26 for(I,N,F)->[F()|for(I+1,N,F)].
  • 相关阅读:
    Numpy库
    使用Python的pandas-datareader包下载雅虎财经股价数据
    python引用库异常总结
    桌面常用快捷键
    第四章 数据的概括性度量
    第三章 数据的图表展示
    python连接MySql数据库
    如何利用scrapy新建爬虫项目
    幼儿教育
    PyMySQL和MySQLdb的区别
  • 原文地址:https://www.cnblogs.com/eiguleo/p/4465629.html
Copyright © 2011-2022 走看看