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
application:start(inets).
httpc:set_options([{cookies,enabled}]).
httpc:request("http://1.1.13.4/user/login").
httpc:request(post,{"post url --remember add v2",[],"application/x-www-form-urlencoded", lists:concat(["post string curl use -d"])},[],[]).
httpc:request(post,{"post url",[],"application/x-www-form-urlencoded", lists:concat(["post string curl use -d "])},[],[]). httpc:which_cookies().
[{session_cookies,[{http_cookie,"1.1.13.4",true,
"JSESSIONID","aaa6JQwGALt04aTzzID1u",undefined,session,"/",
false,false,"0"},
{http_cookie,"1.1.13.4",true,"X-XX-SESS-ID", %% u know what XX is
"f9vl028l6seblbh7v9i03ico02",undefined,session,"/",false,
false,"0"},
{http_cookie,"1.1.13.4",true,"language","zh",undefined,
session,"/",false,false,"0"}]}]
4,e.z test case
File Edit Options Buffers Tools Help
-module(tt).
-export([max/1]). max(N)->
Max=erlang:system_info(process_limit),
io:format("Maximum allowd processes:~p~n",[Max]),
statistics(runtime),
statistics(wall_clock),
L=for(1,N,fun()-> spawn(fun()->wait() end) end),
{_,Time1}=statistics(runtime),
{_,Time2}=statistics(wall_clock),
lists:foreach(fun(Pid)->Pid ! die end, L),
U1=Time1 * 1000 / N ,
U2=Time2 * 1000 / N ,
io:format("Process spawn time=~p(~p) microseconds~n",
[U1,U2]). wait()->
receive
die -> httpc:request("http://192.168.1.51")
end.
for(N,N,F)->[F()];
for(I,N,F)->[F()|for(I+1,N,F)].