search
HomeBackend DevelopmentPHP Tutorial 微信公众平台模拟登陆有关问题

微信公众平台模拟登陆问题
为了获得用户的头像和用户名,查了下相关资料,只有模拟登陆可以做到。
于是用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
PHP vs. Python: Understanding the DifferencesPHP vs. Python: Understanding the DifferencesApr 11, 2025 am 12:15 AM

PHP and Python each have their own advantages, and the choice should be based on project requirements. 1.PHP is suitable for web development, with simple syntax and high execution efficiency. 2. Python is suitable for data science and machine learning, with concise syntax and rich libraries.

PHP: Is It Dying or Simply Adapting?PHP: Is It Dying or Simply Adapting?Apr 11, 2025 am 12:13 AM

PHP is not dying, but constantly adapting and evolving. 1) PHP has undergone multiple version iterations since 1994 to adapt to new technology trends. 2) It is currently widely used in e-commerce, content management systems and other fields. 3) PHP8 introduces JIT compiler and other functions to improve performance and modernization. 4) Use OPcache and follow PSR-12 standards to optimize performance and code quality.

The Future of PHP: Adaptations and InnovationsThe Future of PHP: Adaptations and InnovationsApr 11, 2025 am 12:01 AM

The future of PHP will be achieved by adapting to new technology trends and introducing innovative features: 1) Adapting to cloud computing, containerization and microservice architectures, supporting Docker and Kubernetes; 2) introducing JIT compilers and enumeration types to improve performance and data processing efficiency; 3) Continuously optimize performance and promote best practices.

When would you use a trait versus an abstract class or interface in PHP?When would you use a trait versus an abstract class or interface in PHP?Apr 10, 2025 am 09:39 AM

In PHP, trait is suitable for situations where method reuse is required but not suitable for inheritance. 1) Trait allows multiplexing methods in classes to avoid multiple inheritance complexity. 2) When using trait, you need to pay attention to method conflicts, which can be resolved through the alternative and as keywords. 3) Overuse of trait should be avoided and its single responsibility should be maintained to optimize performance and improve code maintainability.

What is a Dependency Injection Container (DIC) and why use one in PHP?What is a Dependency Injection Container (DIC) and why use one in PHP?Apr 10, 2025 am 09:38 AM

Dependency Injection Container (DIC) is a tool that manages and provides object dependencies for use in PHP projects. The main benefits of DIC include: 1. Decoupling, making components independent, and the code is easy to maintain and test; 2. Flexibility, easy to replace or modify dependencies; 3. Testability, convenient for injecting mock objects for unit testing.

Explain the SPL SplFixedArray and its performance characteristics compared to regular PHP arrays.Explain the SPL SplFixedArray and its performance characteristics compared to regular PHP arrays.Apr 10, 2025 am 09:37 AM

SplFixedArray is a fixed-size array in PHP, suitable for scenarios where high performance and low memory usage are required. 1) It needs to specify the size when creating to avoid the overhead caused by dynamic adjustment. 2) Based on C language array, directly operates memory and fast access speed. 3) Suitable for large-scale data processing and memory-sensitive environments, but it needs to be used with caution because its size is fixed.

How does PHP handle file uploads securely?How does PHP handle file uploads securely?Apr 10, 2025 am 09:37 AM

PHP handles file uploads through the $\_FILES variable. The methods to ensure security include: 1. Check upload errors, 2. Verify file type and size, 3. Prevent file overwriting, 4. Move files to a permanent storage location.

What is the Null Coalescing Operator (??) and Null Coalescing Assignment Operator (??=)?What is the Null Coalescing Operator (??) and Null Coalescing Assignment Operator (??=)?Apr 10, 2025 am 09:33 AM

In JavaScript, you can use NullCoalescingOperator(??) and NullCoalescingAssignmentOperator(??=). 1.??Returns the first non-null or non-undefined operand. 2.??= Assign the variable to the value of the right operand, but only if the variable is null or undefined. These operators simplify code logic, improve readability and performance.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools