Analog Login 115 Network Disk (MFC version)

Source: Internet
Author: User

[CPP] view plain copy

    1. Analogue Landing 115 Network disk
    2. #include <afxinet.h>//include related header files
    3. /* Grab the bag with the grab kit to get the data you need to submit, then simulate the commit.
    4. * (sometimes you need to get cookie information, you can use the Cinternetsession::getcookie () function to get the cookie information) */
[CPP]View PlainCopy
  1. Try
  2. {
  3. #define MAX_COUNT 1024
  4. CInternetSession session (_t ("session"));
  5. Internet_port nport = 80;
  6. chttpconnection* Phttpconnect = session.  GetHttpConnection (_t ("passport.115.com"), nport);
  7. if (phttpconnect)
  8. {
  9. chttpfile* pFile = Phttpconnect->openrequest (Chttpconnection::http_verb_post, _t ("/?ac=login"));
  10. if (pFile)
  11. {
  12. //Here is the request header information, which is obtained by the Grab kit tool
  13. Pfile->addrequestheaders (_t ("POST/?ac=login http/1.1"));
  14. Pfile->addrequestheaders (_t ("Accept:image/gif, Image/jpeg, Image/pjpeg, Image/pjpeg, application/ X-shockwave-flash, Application/x-ms-application, APPLICATION/X-MS-XBAP, Application/vnd.ms-xpsdocument,  Application/xaml+xml, Application/vnd.ms-excel, Application/vnd.ms-powerpoint, Application/msword, */* "));
  15. Pfile->addrequestheaders (_t ("referer:http://passport.115.com/?ac=login&goto=http%3a%2f%2fu.115.com%  2f%3fac%3dmy "));
  16. Pfile->addrequestheaders (_t ("ACCEPT-LANGUAGE:ZH-CN"));
  17. Pfile->addrequestheaders (_t ("user-agent:mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; trident/4.0; SV1;  Easybits GO v1.0;. NET CLR 2.0.50727;. NET CLR 3.0.04506.648;. NET CLR 3.5.21022));
  18. Pfile->addrequestheaders (_t ("content-type:application/x-www-form-urlencoded"));
  19. Pfile->addrequestheaders (_t ("accept-encoding:gzip, deflate"));
  20. Pfile->addrequestheaders (_t ("host:passport.115.com"));
  21. Pfile->addrequestheaders (_t ("connection:keep-alive"));
  22. Pfile->addrequestheaders (_t ("Cache-control:no-cache"));
  23. Here is the data to be submitted. Note: [e-mail protected] refers to the address of the login mailbox, the following xxxxxxx is the login password, when used for your own can
  24. TCHAR Szrequest[max_count] = _t ("Login%5baccount%[email protected]&login%5bpasswd%5d=xxxxxxx&goto=  Http%3a%2f%2fu.115.com%2f%3fac%3dmy ");
  25. Pfile->sendrequest (NULL, 0, Szrequest, _tcslen (szrequest) +1);
  26. CString strstatus (_t (""));
  27. if (Pfile->queryinfo (Http_query_raw_headers_crlf, strstatus))
  28. {
  29. AfxMessageBox (strstatus);
  30. }
  31. Pfile->close ();
  32. Delete pFile;
  33. PFile = NULL;
  34. }
  35. }
  36. Phttpconnect->close ();
  37. Delete phttpconnect;
  38. Phttpconnect =null; Session. Close ();
  39. }
  40. catch (cinternetexception* e)
  41. {
  42. E->reporterror ();
  43. E->delete ();
  44. }

http://blog.csdn.net/visualeleven/article/details/6656224

Analog Login 115 Network Disk (MFC version)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.