• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 258
  • Last Modified:

Getting data from a web page and set this data into a database

  I'm really new in Delphi programming, and I'm very lost. I need to make a program that does the following:
Take a string to be searched in a web page
The program must be able to select the web page to be the object of the search (google, yahoo, etc) (I already did that)
The results of the search must be shown in a listbox in this way:
   - New web sites (sites never visited) must be shown as green
   - Visited web sites must be shown as red

I have problems to start the database (just one table in it), and for getting the data from the web page. I don't know what classes I must use. Please, I'd appreciate any help with this matter. I need to make this program along this weekend, or I'll be fired. Thanks for the help.
  • 2
1 Solution
Ok first of all we need to know what type of database you want to connect to before we can write code to handle this.

A basic way to read a webpage is to put an idHTTP1 component onto the form from the Indy Clients tab and then
procedure TForm1.Button1Click(Sender: TObject);
  Memo1.Text := idHttp1.Get('http://www.google.com');

You could then loop through the memo to find specific words you are looking for
bantonioAuthor Commented:
   Sorry for the delay. I've been pretty busy with this. Thanks for the help. I've already done the database part, but now I need to get the data from the web page. I'm using an TIdHTTP object that calls the following

var response: TString;
     IdHTTP1: TIdHTTP;

I always get the exception EIdHTTPProtocolException with message 'HTTP/1.1 302 Found'

I don't know if it could be because of the initial values of this object. Please, any help with this matter will be appreciated. Thanks again for the help.
bantonioAuthor Commented:
  I already solved the problems. Thanks mikelittlewood for your help. There are good people here  :). I'm new using this site, and I don't know how to give my points to you. I'll figured it out anyway. Thanks again. See ya.

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now