一个本站POST登陆的简单例子

admin 1天前 72

 import console;
import crypt;
var url="https://aardio.online"

hlogin=function(id,pw){
	console.dump("hlogin");
	import inet.http;
	import string.html;
	var http=inet.http();
	var ret=http.post(url+"/user-login.htm",{
		email=id;
		password=string.lower(crypt.md5(pw));
		});
	console.dump(string.html.toText(ret))
}

rlogin=function(id,pw){
	import web.rest.client;
	var http=web.rest.client();
	var ret=http.post(url+"/user-login.htm",{
		email=id;
		password=string.lower(crypt.md5(pw));
		});
	var ok=http.api(url,,"退出").get();
	if ok console.dump("已经成功登陆");
}

wlogin=function(id,pw){
	import web.form;
	import web.multipartFormData
	var wb = web.form();
	var formData = web.multipartFormData();
	formData.add("email",id);
	formData.add("password",string.lower(crypt.md5(pw)));
	wb.post(url+"/user-login.htm"
	, formData.readAll()  
	, formData.contentHeader()
	);
	wb.go(url);
	wb.wait();
	console.dump(wb.querySelector("header").innerText)
	
}


//hlogin("用户名","密码");
//rlogin("用户名","密码");
wlogin("用户名","密码");
console.pause();


最新回复 (1)
  • 沉默的斗鱼 1天前
    0 2
    运行报错
返回
发新帖