Search-result-opening program

This is a discussion on Search-result-opening program within the C++ Programming forums, part of the General Programming Boards category; Hey everyone. Here's what my boss wants me to do: You start a program enter a few words, and the ...

  1. #1
    Registered User
    Join Date
    May 2004
    Posts
    73

    Search-result-opening program

    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!

  2. #2
    Registered User
    Join Date
    Apr 2003
    Posts
    2,662
    I navigate to the internet explorer directory and type "IEXPLORE.EXE [url]" where [url] is that string up there. It will open the page.
    As far as I can tell, that pretty much says to launch IE with the given url. In my web surfing experience, it's not possible to use IE to navigate to a url without ever opening IE. Maybe you can programatically open IE but make it invisible?
    Last edited by 7stud; 08-01-2005 at 05:16 PM.

  3. #3
    Registered User
    Join Date
    May 2004
    Posts
    73
    Sorry, for the weird question, it's hard to explain.

    What I want is to get a page's contents into a character array. That's all I need to do.

    I've already made the main part of the program, and here's what I do so far: I ask the user for the query, and my program launches internet explorer, into the google result page. I ask the user to go to View -> Source in the explorer, and save it to a file. Then the user would enter that file's path into my program, I would open the file, and copy all of it into a character array.

    Wow. That's a huge and confusing process. It would be so much easier if I could just get a page's contents into a character array, without the user's help. So my question is: How do I get a page's contents into a character array?

    Thanks

  4. #4
    Registered User
    Join Date
    May 2004
    Posts
    73
    I recently found a better way to do this. Google has a "web api" that lets people search from within their programs. Unfortunately, it's only written for visual basic, java, and c#. Fortunately, someone made a "gSOAP c++" thing for it, that lets you use C++ with it. Unfortunately, I tried it and couldn't get it to run.

    Has anyone tried this out?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. BOOKKEEPING PROGRAM, need help!
    By yabud in forum C Programming
    Replies: 3
    Last Post: 11-16-2006, 10:17 PM
  2. Simple search program
    By colinuk in forum C Programming
    Replies: 6
    Last Post: 12-18-2004, 12:58 AM
  3. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  4. putting search result into a linked list
    By jetfreggel in forum C Programming
    Replies: 4
    Last Post: 03-03-2003, 12:22 PM
  5. search array program
    By z.tron in forum C++ Programming
    Replies: 3
    Last Post: 11-15-2002, 06:33 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21