Home  >  Article  >  Backend Development  >  微信公众平台模拟登陆有关问题

微信公众平台模拟登陆有关问题

WBOY
WBOYOriginal
2016-06-13 12:35:05957browse

微信公众平台模拟登陆问题
为了获得用户的头像和用户名,查了下相关资料,只有模拟登陆可以做到。
于是用snoopy模拟登陆代码如下

<br />
<?php <br />
<br />
include('Snoopy.class.php');<br />
<br />
 function login(){<br />
	$snoopy = new Snoopy(); <br />
	$submit = "http://mp.weixin.qq.com/cgi-bin/login?lang=zh_CN";<br />
	$post["username"] = '我的账号';<br />
	$post["pwd"] = substr(md5('我的密码'), 0,16);<br />
	echo $post["pwd"];<br />
	$post["f"] = "json";<br />
	$snoopy->submit($submit,$post);<br />
	$cookie = '';<br />
	print_r($snoopy->headers);exit;<br />
	<br />
 }<br />
 login();<br />
?><br />

获得的头部信息中没有set-cookie 登陆失败,请问,我这段程序错在哪里了?还是说最近微信改了他的代码了,我看微信公众平台上的登陆js也是post过去这几个内容
<br />
var createLoginForm = function(e) {<br />
var t = jQuery, n = function() {<br />
var e = !1;<br />
inputs = m.getVal();<br />
switch (!1) {<br />
case !!inputs.account:<br />
s.trigger("Warning", [ f, "你还没有输入帐号!" ]);<br />
break;<br />
case !!inputs.password:<br />
s.trigger("Warning", [ l, "你还没有输入密码!" ]);<br />
break;<br />
case !!inputs.verify || !!c.data("isHide"):<br />
s.trigger("Warning", [ h, "你还没有输入验证码!" ]), r();<br />
break;<br />
default:<br />
e = !0;<br />
}<br />
return e;<br />
}, r = function() {<br />
h.val(""), p.attr("src", "/cgi-bin/verifycode?username=" + m.getVal().account + "&r=" + +(new Date));<br />
}, i = e.selector, s = t(i.error), o = t(i.errorArea), u = t(i.rememberAcct), a = t(i.changeImgLink), f = t(i.account).keydown(function(e) {<br />
e.keyCode == 13 && l.focus().select();<br />
}), l = t(i.password).keydown(function(e) {<br />
e.keyCode == 13 && d.click();<br />
}), c = t(i.verifyArea).data("isHide", 1).hide(), h = t(i.verify).keydown(function(e) {<br />
e.keyCode == 13 && (l.val() ? d.click() : l.focus().select());<br />
}), p = t(i.verifyImg).click(r), d = t(i.loginBtn), v = function(e, t) {<br />
return;<br />
var n, r, i;<br />
};<br />
s.bind("Warning", function(e, t, n) {<br />
o.removeClass("dn"), s.text(n).hide().fadeIn();<br />
}), p.bind({<br />
load: function() {<br />
v([ f, l ]), c.show().data("isHide", 0), h.focus().select();<br />
},<br />
error: function() {}<br />
}), s.bind("Response", function(e, t, n) {<br />
o.removeClass("dn"), s.html(n).hide().fadeIn(), v([ f, l ], "N"), c.data("isHide") || r();<br />
switch (t) {<br />
case "-3":<br />
l.focus().select();<br />
break;<br />
case "-6":<br />
h.focus().select();<br />
break;<br />
default:<br />
f.focus().select();<br />
}<br />
t != "-32" && l.val("");<br />
});<br />
var m = {<br />
showVerifyImg: r,<br />
submit: function() {<br />
if (!n()) return;<br />
var e = m.getVal();<br />
t.post("/cgi-bin/login?lang=zh_CN", {<br />
username: e.account,<br />
pwd: t.md5(e.password.substr(0, 16)),<br />
imgcode: c.data("isHide") ? "" : e.verify,<br />
f: "json"<br />
}, function(t) {<br />
var n = t.ErrCode + "", i;<br />
u.hasClass("checkbox_checked") ? WXM.Helpers.setCookie("remember_acct", e.account, 30) : WXM.Helpers.setCookie("remember_acct", "EXPIRED", -1);<br />
switch (n) {<br />
case "-1":<br />
i = "系统错误,请稍候再试。";<br />
break;<br />
case "-2":<br />
i = "帐号或密码错误。";<br />
break;<br />
case "-3":<br />
i = "您输入的帐号或者密码不正确,请重新输入。";<br />
break;<br />
case "-4":<br />
i = "不存在该帐户。";<br />
break;<br />
case "-5":<br />
i = "您目前处于访问受限状态。";<br />
break;<br />
case "-6":<br />
i = "请输入图中的验证码", r();<br />
return;<br />
case "-7":<br />
i = "此帐号已绑定私人微信号,不可用于公众平台登录。";<br />
break;<br />
case "-8":<br />
i = "邮箱已存在。";<br />
break;<br />
case "-32":<br />
i = "您输入的验证码不正确,请重新输入", r();<br />
break;<br />
case "-200":<br />
i = "因频繁提交虚假资料,该帐号被拒绝登录。";<br />
break;<br />
case "-94":<br />
i = "请使用邮箱登陆。";<br />
break;<br />
case "10":<br />
i = "该公众会议号已经过期,无法再登录使用。";<br />
break;<br />
case "65201":<br />
case "65202":<br />
i = "成功登陆,正在跳转...", location.href = t.ErrMsg;<br />
return;<br />
case "0":<br />
i = "成功登陆,正在跳转...", location.href = t.ErrMsg;<br />
return;<br />
case "-100":<br />
i = '海外帐号请在公众平台海外版登录,<a href="http://admin.wechat.com/">点击登录</a>';<br />
break;<br />
default:<br />
i = "未知的返回。";<br />
return;<br />
}<br />
s.trigger("Response", [ n, i ]);<br />
}, "json");<br />
},<br />
getVal: function() {<br />
return {<br />
account: t.trim(f.val()),<br />
password: t.trim(l.val()),<br />
verify: t.trim(h.val())<br />
};<br />
},<br />
setVal: function(e, n) {<br />
return t(i).val(n).length;<br />
}<br />
};<br />
return a.click(function() {<br />
m.showVerifyImg();<br />
}), d.click(m.submit), f.focus(), m;<br />
};<br />

也是这四个值
username: e.account,
pwd: t.md5(e.password.substr(0, 16)),
imgcode: c.data("isHide") ? "" : e.verify,

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn