In order to capture the interest of the tribe's data, studied the next QQ automatic login.
At that time, we found that most of the methods had been invalidated, so I was ready to do it myself.
The first thing to think about is to refer to the practice of online programs, comb the implementation of JS, through other languages rewrite.
Given that JS may be updated, this scenario is discarded.
The second thought is can directly call QQ own JS method, simulation to commit it.
After searching, the artifact ———— "Phantomjs" was found.
Phantomjs is a headless WebKit scriptable with a JavaScript API. It has fast and native support for various web standards:dom handling, CSS selector, JSON, Canvas, and SVG.
So the code is implemented as follows.
varpage = require (' webpage '). Create ();varFS = require ("FS");p age.settings.userAgent= ' mozilla/5.0 (iPhone; CPU iPhone os 8_0 like Mac os X applewebkit/600.1.3 (khtml, like Gecko) version/8.0 mobile/12a4345d safari/600.1.4 ';p Age.open (' http://ui.ptlogin2.qq.com/cgi-bin/login?pt_no_onekey=1&style=9&appid=1006102&s_url=http%3A%2F% 2fxiaoqu.qq.com%2fmobile%2fbarindex.html%3f_lv%3d29313%26_bid%3d128%26_wv%3d1027%26from%3dshare_link%23bid% 3d37469%26type%3d%26source%3dindex%26scene%3drecent%26from%3ddongtai%26webview%3d1&low_login=0&hln_css =http%3a%2f%2fpub.idqqimg.com%2fqqun%2fxiaoqu%2fmobile%2fimg%2fnopack%2flogin-logo.png ',function(status) {if(Status = = ' Success ')) {Page.render (' Index.png '); SetTimeout (function() {page.evaluate (function() {document.getElementById (' U '). Value = ' QQ number '; document.getElementById (' P '). Value = ' qq password '; Pt.check (false); }); SetTimeout (function() {file= Fs.open ("Cookie.log", ' W '); File.write (Json.stringify (page.cookies)); File.close (); Phantom.exit (); }, 2000); }, 1000); }});
The cookie is written to the Cookie.log file in the current directory, and with the cookie the next thing is much simpler. Use PHP or JS to type cookies into your browser.
Report:
to download the PHANTOMJS version of Windows:Http://phantomjs.org/download.html
run the cmd command under the current folder:1. Hold down the SHIFT key on the desktop, then right-click the option "Open command Window here (W)" To open the command line. 2. Click "Open Command Window (W) Here" to enter the cmd command line interface. Reference article: Using PHANTOMJS simulation QQ Automatic login: Https://www.liudon.org/1327.htmlQQ simulation Login Implementation of the four-and-a-two (based on the V8 engine): Http://ju.outofmemory.cn/entry /246396PHANTOMJS Automatic download of website under Windows7 (contains PHANTOMJS installation under Windows7): http://www.cnblogs.com/huangcong/archive/2013/04/ 18/3027654.html
Use PHANTOMJS to simulate QQ automatic login