添加二维码自动打开
This commit is contained in:
parent
2582249a57
commit
1b7588a98f
@ -314,6 +314,11 @@ int HTTPConnection::setPostData(const std::string& data)
|
||||
return setPostData(data.c_str(),data.size());
|
||||
}
|
||||
|
||||
int HTTPConnection::setFollowLocation(bool enable)
|
||||
{
|
||||
return invokeLib(curl_easy_setopt,_p->c,CURLOPT_FOLLOWLOCATION,enable?1:0);
|
||||
}
|
||||
|
||||
int HTTPConnection::setMethod(Method m)
|
||||
{
|
||||
switch(m)
|
||||
|
@ -62,6 +62,7 @@ public:
|
||||
int setOrigin(const std::string& origin);
|
||||
int setPostData(const void* data,int sz);
|
||||
int setPostData(const std::string& data);
|
||||
int setFollowLocation(bool enable);/// disabled by default
|
||||
|
||||
enum class Method
|
||||
{
|
||||
|
13
src/main.cpp
13
src/main.cpp
@ -9,6 +9,7 @@ using namespace nlohmann;
|
||||
void Delay(int second);
|
||||
string UTF8ToGBK(string UTF8String);
|
||||
string GBKToUTF8(string GBKString);
|
||||
void OpenQRCode();
|
||||
|
||||
const string USERAGENT="Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.79 Safari/537.36";
|
||||
|
||||
@ -17,7 +18,6 @@ string qrsig;
|
||||
int GetQRCode()
|
||||
{
|
||||
HTTPConnection t;
|
||||
t.setVerbos(true);
|
||||
t.setUserAgent(USERAGENT);
|
||||
t.setURL("https://ssl.ptlogin2.qq.com/ptqrshow?appid=501004106&e=0&l=M&s=5&d=72&v=4&t=0.1");
|
||||
t.setDataOutputFile("qrcode.png");
|
||||
@ -32,6 +32,9 @@ int GetQRCode()
|
||||
}
|
||||
}
|
||||
|
||||
OpenQRCode();
|
||||
printf("二维码已打开. 请使用手机扫描二维码进行登录.\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -175,7 +178,8 @@ int GetVfWebQQ()
|
||||
|
||||
printf("VfWebQQBuff: %s\n",buff);
|
||||
|
||||
json j(buff);
|
||||
/// 修复exception
|
||||
json j=json::parse(buff);
|
||||
vfwebqq=j["vfwebqq"];
|
||||
|
||||
return 0;
|
||||
@ -201,6 +205,11 @@ int GetUinPsessionid()
|
||||
return 0;
|
||||
}
|
||||
|
||||
class Client
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
GetQRCode();
|
||||
|
@ -87,3 +87,8 @@ string GBKToUTF8(string GBKString)
|
||||
delete[] utf8str;
|
||||
return s;
|
||||
}
|
||||
|
||||
void OpenQRCode()
|
||||
{
|
||||
ShellExecute(NULL,"open","qrcode.png",NULL,NULL,SW_SHOWMAXIMIZED);
|
||||
}
|
||||
|
Reference in New Issue
Block a user