Closed Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: feed search term into a url

  1. #1
    pragan is offline Newbie
    Join Date
    Jun 2008
    Posts
    3
    Rep Power
    0

    feed search term into a url

    hi,

    I am trying to write a script which can do the following. I do not have any idea of how to write it ..but have the idea of how it should/will work.

    I have a list of words in an mysql db(almost 1000 words). I need to take each word and then put in the search query of any search engine(for example ask.com) and store the result that appears under "related words"/"suggested words"/"narrow your search words" in a file.

    Example:
    If you search for the word "forum" in ask.com, we can see the url as
    forum - Ask.com Web Search

    and the search result page contains "Narrow Your Search"

    Roman Forum
    Free Forum
    ..
    ...
    etc.

    So I need to write a script that can take word by word from my mysql db and put it in the url (as below) and then store only the "result under "Narrow your search result" in a file.
    Ask.com Search Engine - Better Web Searchnextword&search=search&qsrc=0&o=0&l=dir

    Please let me know if its something possible and if I can have look at any examples..I would need to complete this as soon as possible.

    I can explain it in a more better way if the above explanation is not clear.

    Regards

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Jordan Guest

    Re: feed search term into a url

    This sounds possible. First "select" all of the words from your database and do a loop. I recommend using MySQLi if you have it installed. I wrote a blog on it here: PHP MySQL Improved

    Next you'll use Curl to emulate a browser and connect to the search engine submitting the keyword you extracted from the database. From there you can retrieve the data and modify it how you like.

  4. #3
    Join Date
    Mar 2008
    Location
    The North Pole
    Posts
    13,174
    Blog Entries
    13
    Rep Power
    114

    Re: feed search term into a url

    ... and to extract it, use getch().
    Last edited by Xav; 06-24-2008 at 12:01 PM.

    Quote Originally Posted by Jordan View Post
    Good members, like yourself, stick around and post for ages to come!
    Mr. Xav | Blog | Forums

  5. #4
    Jordan Guest

    Re: feed search term into a url

    Curl will return the contents of the website, he will just need to assign it to a string.

  6. #5
    Join Date
    Mar 2008
    Location
    The North Pole
    Posts
    13,174
    Blog Entries
    13
    Rep Power
    114

    Re: feed search term into a url

    I didn't say "retrieve", I said "extract".

    Quote Originally Posted by Jordan View Post
    Good members, like yourself, stick around and post for ages to come!
    Mr. Xav | Blog | Forums

  7. #6
    Jordan Guest

    Re: feed search term into a url

    lol. Also, there is no getch() function in PHP. There is ncurses_getch although it is experimental.

  8. #7
    Join Date
    Mar 2008
    Location
    The North Pole
    Posts
    13,174
    Blog Entries
    13
    Rep Power
    114

    Re: feed search term into a url

    I thought that was the one used for extracting specific data from HTML?

    Quote Originally Posted by Jordan View Post
    Good members, like yourself, stick around and post for ages to come!
    Mr. Xav | Blog | Forums

  9. #8
    Jordan Guest

    Re: feed search term into a url

    Nope, unless it was custom made.

  10. #9
    Join Date
    Mar 2008
    Location
    The North Pole
    Posts
    13,174
    Blog Entries
    13
    Rep Power
    114

    Re: feed search term into a url

    Oh - is it preg_match?

    Quote Originally Posted by Jordan View Post
    Good members, like yourself, stick around and post for ages to come!
    Mr. Xav | Blog | Forums

  11. #10
    Jordan Guest

    Re: feed search term into a url

    You can use that with regular expressions to extract most of the HTML data you would need.

Closed Thread
Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. term-printable, keymaps and c
    By zz5-ux in forum C and C++
    Replies: 3
    Last Post: 12-27-2010, 12:23 PM
  2. Help me with term exams...
    By Kenan in forum C and C++
    Replies: 1
    Last Post: 12-08-2010, 12:09 PM
  3. Replies: 1
    Last Post: 03-18-2010, 10:15 AM
  4. some computer term??
    By R3.RyozKidz in forum C and C++
    Replies: 4
    Last Post: 10-17-2009, 01:37 AM
  5. **Contest POINTS**: Where did the term bug come from?
    By Jordan in forum General Programming
    Replies: 3
    Last Post: 01-08-2007, 05:35 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts