mitchellmckain,
I am working on similar project myself. In my case I can not say that I am so innocent, in the way of cracking that is, although my plights are all for research using my own usernames before anyone complains. Well actually I don’t care if anyone complains, I will still do it. On to the story…
I am accessing the Yahoo! login pages and need various information back, such as if the login was successful or not. In the case of Yahoo!, the status of login is given in the HTTP status code at the very beginning of the received packet. I am using Visual Basic.NET 2003 as my programming language. I know that this does not go very well with C++ but I believe for your purposes you might want to look into the .NET suite.
I m not using IE for any data transfer but a built-in data type called “HttpWebRequest”. After the variable is typed a method called Create is issued with the host in it. Then GetResponse actually contacts the server and a response is brought back to the computer. A small sample is given below and is actual code from my project.
CODE
'The object used to define a http request
Dim httpRequest As HttpWebRequest
‘The object that is the response
Dim httpResponse As HttpWebResponse
‘The HttpWebResponse has to be converted into a stream
‘with a certain encoding before it can be read as a string
Dim responseStream As Stream
Dim responseEncoding As Encoding
Dim responseStreamReader As StreamReader
‘The string that will hold the html
Dim strReturnCode As String
Try
‘This is were you put the server information
httpRequest = CType(WebRequest.Create("http://www.google.com"), HttpWebRequest)
‘Go get the response
httpResponse = CType(httpRequest.GetResponse(), HttpWebResponse)
‘I grab the HTTP status here
strReturnCode = httpResponse.StatusCode.ToString
‘Make the response into a string
responseStream = httpResponse.GetResponseStream()
responseEncoding = System.Text.Encoding.GetEncoding("utf-8")
responseStreamReader = New StreamReader(responseStream, responseEncoding)
Catch ex As WebException
MessageBox.Show(ex.Status.ToString)
End Try
‘The stream is finally made into a string
Dim strResponse As String = responseStreamReader.ReadToEnd
This is a very specific example of what you might do. After you receive the string you will have to so some application specific processing on it to get your information out. In my case the HTTP status code is the most important thing so I don’t have to dig into the html. If the page is fairly static then you shouldn’t have that hard of a time parsing the information you are after.
As for using IE for this task I am not sure if it is possible. There may be some Windows COM calls that you can place but I would recommend against it. Making a direct request will give you much more control over your code.
I know that this is not exactly what you are looking for since you are a C++ guy but I hope it helps you a little.
Reply