trying to read an html file into visual c++ with username & password?
I am trying to read the html contents of a web page into my program (using visual c++). Normally what I do is something like...
CString inputLine;
CInternetSession intSess;
CStdioFile *myInFile = intSess.OpenURL("http://www.xyz.com/");
while(myInFile->ReadString(inputLine) {
// process each line of the html file that is read into inputLine
}
myInFile->Close();
that works okay. But, now what I want to do is access something where I have a username and password. For instance, lets say I want to read the contents of http://answers.yahoo.com/my-activity with my program. That page provides different html code based on your yahoo username & password.
I found CHttpConnect which looks like I can specify a username and password. I tried calling that between constructing the CInternetSession and doing the OpenURL. With it looking like
CHttpConnect myHttp = intSess.GetHttpConnection("www.yahoo.com", 80, "username@yahoo.com", "password");
But that didn't seem to work. I suspect I might need to use the CHttpConnect method OpenRequest, but I can't make heads or tails out of what any of the parameters mean. Can someone who's more knowledgeable about internet programming please provide a snippet of code that does the same thing as my little snippet except works with usernames and passwords?
[as a side question, do these usernames and passwords get encrypted or do they go out on the net as clear text?]