Note:
1. The host referred to in all HTTP requests below is f.10086.cn
2, currently only China Mobile users can use
1. Open login page: get/huc/user/space/login.do?m=submit&fr=space, get two cookie values: Jsessionid and UUID
2, Login: post/huc/user/space/login.do, data for mobile phone number and password: Mobilenum=your_phone_number&password=your_fetioon_password &m=submit&backurl=http%3a%2f%2ff.10086.cn%2f&fr=space, get Cookie value: Set-cookie:cell_cookie, note: When logged in, Need to carry header:content-type:application/x-www-form-urlencoded, otherwise it will trigger verification code check
2.1. Step 2 above will redirect to another path: Location:http://f.10086.cn/?nuc_id=5cb9e9eca65e2bc2875a6fe55869daa1, 4e8cbe602e50b189ddc33e51de704474,e017a7e72b081563f1fbf1263d2fd8f8,1
2.2, http://f.10086.cn/?nuc_id=5cb9e9eca65e2bc2875a6fe55869daa1,4e8cbe602e50b189ddc33e51de704474, e017a7e72b081563f1fbf1263d2fd8f8,1<----This will continue to redirect to Location:http://f.10086.cn/wap2.jsp, and will reset the cookie value: Jsessionid. WAP2.JSP is a comprehensive news page.
3. Send message: Post/im/user/sendmsgtomyselfs.action http/1.1, data: msg=a Hello Word Short message
3.1, the above steps may be redirected to location:http://f.10086.cn/im/login/cklogin.action?t=1420875966727, at this time can be re-post/im/user/ Sendmsgtomyselfs.action http/1.1, you can send the success.
is the use of MFC WinInet implementation of the demo, when this article published, still can send SMS
In addition, the code has not been tempered, please do not care about memory leaks and other bugs ...
#define FE_BUFFER_SIZE (1024*1024) void Do_me () {hinternet hsesshnd; Hinternet hconnhnd; Hinternet hrqsthnd; BOOL Brqstret; BOOL Bqueryret; BOOL Breadret; uchar* Pucbuffer = new Uchar[fe_buffer_size]; DWORD Dwbufferlen; DWORD Dwreadlen; DWORD dwindex; Use fiddler proxy hsesshnd = Internetopena ("Fetionmsg", Internet_open_type_proxy, "http=http://127.0.0.1:8888", NULL, 0); Direct Login//hsesshnd = Internetopena ("Fetionmsg", internet_open_type_direct, NULL, NULL, 0); if (NULL = = hsesshnd) {printf ("Internetopena failed\r\n"); Return } hconnhnd = Internetconnecta (hsesshnd, "f.10086.cn", internet_default_http_port, NULL, NULL, internet_service_http, 0, 0); if (NULL = = hconnhnd) {printf ("internetconnecta failed.\r\n"); Return } hrqsthnd = Httpopenrequesta (hconnhnd, "GET", "Huc/user/space/login.do?m=submit&fr=space", "HTTP/1.1", NULL, NULL , Internet_flag_reload, 0); if (NULL = = hrqsthnd) {printf ("Httpopenrequesta failed.\r\n"); Return } Brqstret = Httpsendrequesta (hrqsthnd, NULL, 0, NULL, 0); if (TRUE! = Brqstret) {printf ("Httpsendrequesta failed\r\n"); Return } zeromemory (Pucbuffer, fe_buffer_size); Dwbufferlen = fe_buffer_size; dwindex = 0; Bqueryret = Httpqueryinfoa (hrqsthnd, Http_query_content_length, Pucbuffer, &dwbufferlen, &dwIndex); if (TRUE = = Bqueryret) {printf ("1:len =%s,%u\r\n", Pucbuffer, Dwbufferlen); Breadret = InternetReadFile (hrqsthnd, Pucbuffer, Fe_buffer_size, &dwreadlen); printf ("1 read ret=%u, len=%u\r\n", Breadret, Dwreadlen); printf ("--------\ r \ n"); printf ("%s", Pucbuffer); printf ("--------\ r \ n"); } else {printf ("1 No response body\r\n"); } internetclosehandle (HRQSTHND); HRQSTHND = Httpopenrequesta (hconnhnd, "POST", "huc/user/space/login.do", "http/1.1", NULL, NULL, internet_Flag_reload, 0); if (NULL = = hrqsthnd) {printf ("Httpopenrequesta 2 failed.\r\n"); Return } httpaddrequestheadersa (Hrqsthnd, "content-type:application/x-www-form-urlencoded\r\n",-1, HTTP_ADDREQ_FLAG_ADD) ; Const char* Pclogindata = "mobilenum=your_number&password=your_fetion_password&m=submit&backurl=http% 3a%2f%2ff.10086.cn%2f&fr=space "; Brqstret = Httpsendrequesta (hrqsthnd, NULL, 0, (void*) Pclogindata, strlen (Pclogindata)); if (TRUE! = Brqstret) {printf ("Httpsendrequesta 2 failed\r\n"); Return } zeromemory (Pucbuffer, fe_buffer_size); Dwbufferlen = fe_buffer_size; dwindex = 0; Bqueryret = Httpqueryinfoa (hrqsthnd, Http_query_content_length, Pucbuffer, &dwbufferlen, &dwIndex); if (TRUE = = Bqueryret) {printf ("2:len =%s,%u\r\n", Pucbuffer, Dwbufferlen); Breadret = InternetReadFile (hrqsthnd, Pucbuffer, Fe_buffer_size, &dwreadlen); printf ("2 read ret=%u, len=%u\r\N ", Breadret, Dwreadlen); printf ("--------\ r \ n"); printf ("%s", Pucbuffer); printf ("--------\ r \ n"); } else {printf ("2 No response body\r\n"); } internetclosehandle (HRQSTHND); HRQSTHND = Httpopenrequesta (hconnhnd, "POST", "Im/user/sendmsgtomyselfs.action", "http/1.1", NULL, NULL, 0, 0); if (NULL = = hrqsthnd) {printf ("Httpopenrequesta 3 failed.\r\n"); Return } const char* Pcmsgdata = "Msg=helloworld"; Brqstret = Httpsendrequesta (hrqsthnd, NULL, 0, (void*) Pcmsgdata, strlen (Pcmsgdata)); if (TRUE! = Brqstret) {printf ("Httpsendrequesta 3 failed\r\n"); Return } zeromemory (Pucbuffer, fe_buffer_size); Dwbufferlen = fe_buffer_size; dwindex = 0; Bqueryret = Httpqueryinfoa (hrqsthnd, Http_query_content_length, Pucbuffer, &dwbufferlen, &dwIndex); if (TRUE = = Bqueryret) {printf ("3:len =%s,%u\r\n", Pucbuffer, Dwbufferlen); Breadret = InternetReadFile (hrqsthnD, Pucbuffer, Fe_buffer_size, &dwreadlen); printf ("3 Read ret=%u, len=%u\r\n", Breadret, Dwreadlen); printf ("--------\ r \ n"); printf ("%s", Pucbuffer); printf ("--------\ r \ n"); } else {printf ("3 no response body\r\n"); } internetclosehandle (HRQSTHND); HRQSTHND = Httpopenrequesta (hconnhnd, "POST", "Im/user/sendmsgtomyselfs.action", "http/1.1", NULL, NULL, 0, 0); if (NULL = = hrqsthnd) {printf ("Httpopenrequesta 3 failed.\r\n"); Return } httpaddrequestheadersa (Hrqsthnd, "content-type:application/x-www-form-urlencoded\r\n",-1, HTTP_ADDREQ_FLAG_ADD) ; Brqstret = Httpsendrequesta (hrqsthnd, NULL, 0, (void*) Pcmsgdata, strlen (Pcmsgdata)); if (TRUE! = Brqstret) {printf ("Httpsendrequesta 3 failed\r\n"); Return } zeromemory (Pucbuffer, fe_buffer_size); Dwbufferlen = fe_buffer_size; dwindex = 0; Bqueryret = Httpqueryinfoa (hrqsthnd, Http_query_content_length, Pucbuffer, &DWBUFferlen, &dwindex); if (TRUE = = Bqueryret) {printf ("3:len =%s,%u\r\n", Pucbuffer, Dwbufferlen); Breadret = InternetReadFile (hrqsthnd, Pucbuffer, Fe_buffer_size, &dwreadlen); printf ("3 Read ret=%u, len=%u\r\n", Breadret, Dwreadlen); printf ("--------\ r \ n"); printf ("%s", Pucbuffer); printf ("--------\ r \ n"); } else {printf ("3 no response body\r\n"); } printf ("All ok!\r\n"); InternetCloseHandle (HRQSTHND); InternetCloseHandle (HCONNHND); InternetCloseHandle (HSESSHND);}
Call Fetion HTTP interface to send yourself a text message