Hey everyone. Here's what my boss wants me to do:
You start a program enter a few words, and the program will then ask google to give it a page with the results on it. It won't open an internet explorer window, it will just ask google for the page file. Then, the program will get the first result, and open the page in a new internet explorer window. Once the user closes the window, the program will open the second result in a new window. And it will keep doing that until the user stops.
Here's what I think I should do:
Ask for a string, containing the search query. Let's say the user types in "eekergog maybler bloggyrog" (Don't ask where I got those words :) ). Well, I'll then make the string from "eekergog maybler bloggyrog" into "eekergog+maybler+bloggyrog" and put the string inside this one: "http://www.google.com/search?hl=en&q=".
The resulting string would be http://www.google.com/search?hl=en&q...bler+bloggyrog and it contains the results. Now, I know how to open a page from the console... I navigate to the internet explorer directory and type "IEXPLORE.EXE [url]" where [url] is that string up there. It will open the page. However, this would not work because it opens a new window. What I want is something that will write the page to a .html file or something, which I can then open. Or maybe something that can take it and put it in a giant character array for me. You know, a function like
void GetPage( char* URL, char* Buffer ) would do.
Okay, once I get that page into a character array (If I had gotten the page into the file, I would have just pulled it into a character array), I would then search the page for the "<a href=" string, a link. Of course, I would find a way to determine if this is just a link on the google's result page, or an actual result. Once I get the url of this result, I would then do the "IEXPLORE.EXE [url]" thing like I said above, and keep cycling downward till I have no more links in the string. In the future I would make it go to the next page, but for now I just want it to work on one page.
So my question is, how do I get a page's contents into a character array, without opening an internet explorer window?
Thank you very much for your help. It is really appreciated!