微信公众平台模拟登陆问题
为了获得用户的头像和用户名,查了下相关资料,只有模拟登陆可以做到。
于是用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,

APHPDependencyInjectionContainerisatoolthatmanagesclassdependencies,enhancingcodemodularity,testability,andmaintainability.Itactsasacentralhubforcreatingandinjectingdependencies,thusreducingtightcouplingandeasingunittesting.

Select DependencyInjection (DI) for large applications, ServiceLocator is suitable for small projects or prototypes. 1) DI improves the testability and modularity of the code through constructor injection. 2) ServiceLocator obtains services through center registration, which is convenient but may lead to an increase in code coupling.

PHPapplicationscanbeoptimizedforspeedandefficiencyby:1)enablingopcacheinphp.ini,2)usingpreparedstatementswithPDOfordatabasequeries,3)replacingloopswitharray_filterandarray_mapfordataprocessing,4)configuringNginxasareverseproxy,5)implementingcachingwi

PHPemailvalidationinvolvesthreesteps:1)Formatvalidationusingregularexpressionstochecktheemailformat;2)DNSvalidationtoensurethedomainhasavalidMXrecord;3)SMTPvalidation,themostthoroughmethod,whichchecksifthemailboxexistsbyconnectingtotheSMTPserver.Impl

TomakePHPapplicationsfaster,followthesesteps:1)UseOpcodeCachinglikeOPcachetostoreprecompiledscriptbytecode.2)MinimizeDatabaseQueriesbyusingquerycachingandefficientindexing.3)LeveragePHP7 Featuresforbettercodeefficiency.4)ImplementCachingStrategiessuc

ToimprovePHPapplicationspeed,followthesesteps:1)EnableopcodecachingwithAPCutoreducescriptexecutiontime.2)ImplementdatabasequerycachingusingPDOtominimizedatabasehits.3)UseHTTP/2tomultiplexrequestsandreduceconnectionoverhead.4)Limitsessionusagebyclosin

Dependency injection (DI) significantly improves the testability of PHP code by explicitly transitive dependencies. 1) DI decoupling classes and specific implementations make testing and maintenance more flexible. 2) Among the three types, the constructor injects explicit expression dependencies to keep the state consistent. 3) Use DI containers to manage complex dependencies to improve code quality and development efficiency.

DatabasequeryoptimizationinPHPinvolvesseveralstrategiestoenhanceperformance.1)Selectonlynecessarycolumnstoreducedatatransfer.2)Useindexingtospeedupdataretrieval.3)Implementquerycachingtostoreresultsoffrequentqueries.4)Utilizepreparedstatementsforeffi


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

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.

Atom editor mac version download
The most popular open source editor

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool
