By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,479 Members | 1,749 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,479 IT Pros & Developers. It's quick & easy.

how to access to gmail

P: 2
i write code in c ,i only need to access to gmail using username and password

i didn't know where i can write username and password in this code
Expand|Select|Wrap|Line Numbers
  1. #include <stdio.h>
  2. #include <afxinet.h>
  3. #include <wininet.h>
  4. #include <conio.h>
  5. #include <string.h>
  6. #include <winsock.h>
  7. void main()
  8. {
  9.  
  10.  
  11.             int nResult=0;int result=0;
  12.             HINTERNET hInternet, hHttpSession, hHttpRequest;
  13.  
  14.          hInternet= InternetOpen("MyApp", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
  15.          if (hInternet){
  16.  
  17.              hHttpSession=InternetConnect(hInternet, "https://www.google.com/accounts/",INTERNET_DEFAULT_HTTPS_PORT, 0, 0, INTERNET_SERVICE_HTTP, 0, 0);}
  18.  
  19.          if  (hHttpSession){
  20.              hHttpRequest =HttpOpenRequest(hHttpSession, "POST", "/ServiceLoginAuth?service=mail", 0, 0, 0,INTERNET_FLAG_SECURE, 0);}
  21.          if  (hHttpRequest){ result=HttpSendRequest(hHttpRequest, 0, 0, 0, 0); }
  22.  
  23.              printf("%d",&result);
  24.           InternetCloseHandle(hInternet);
  25.  
  26.          InternetCloseHandle(hHttpSession);
  27.          InternetCloseHandle(hHttpSession);
  28.          InternetCloseHandle(hHttpSession);
  29.  
  30. }     
  31.  
  32.  
  33.  
Nov 7 '08 #1
Share this Question
Share on Google+
1 Reply


100+
P: 424
Go to the gmail login page and look at the source code of the page to figure out how the login and password are submitted to the server. Then subit your own request to the server in a similar manner. It looks like the code you have just requests a webpage from the server, that's not what you need.
Nov 7 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.