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

Posted on 2005-04-22
Last Modified: 2010-04-05
  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.
Question by:bantonio
    LVL 15

    Accepted 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('');

    You could then loop through the memo to find specific words you are looking for

    Author Comment

       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.

    Author Comment

      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.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
    Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now