?
Solved

getting Source Code

Posted on 2003-03-24
6
Medium Priority
?
239 Views
Last Modified: 2010-04-04
I want to get the source code of a website and put it into a textbox?

Any ideas?
0
Comment
Question by:doyuk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 1

Accepted Solution

by:
Knighty earned 1000 total points
ID: 8199509
using the indy component(www.indyproject.or):
Memo1.Lines.Text:= IdHTTP.Get('url');

or using the Fastnet components:
NMHTTP1.Get('url');
Memo1.Text := NMHTTP1.Body;
0
 
LVL 1

Expert Comment

by:Knighty
ID: 8199516
0
 
LVL 1

Expert Comment

by:Knighty
ID: 8199612
or using the ICS component http://overbyte.delphicenter.com/ :
HttpCli1.URL := 'url';
HttpCli1.RcvdStream := TMemoryStream.Create;
HttpCli1.Get;
Memo1.Lines.LoadFromStream(HttpCli1.RcvdStream);
HttpCli1.RcvdStream.Destroy;
HttpCli1.RcvdStream := nil;
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:doyuk
ID: 8201974
Thanks. It works...
0
 
LVL 6

Expert Comment

by:DaFox
ID: 8202036
doyuk, you could also use this function to get rid of all those components:

{ uses WinInet }

function LoadFromURL(URL: String): String;
var
  hSession, hURL: hInternet;
  Buffer: array[0..1023] of Byte;
  BufferLength: DWord;
  Stream: TStringStream;
begin
  stream := TStringStream.Create('');
  Result := '';
  if (Pos('http://', LowerCase(url)) = 0) then URL := 'http://' + URL;
  hSession := InternetOpen('My_App;)', INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0);
  try
    hURL := InternetOpenURL(hSession, PChar(URL), nil, 0, INTERNET_FLAG_RELOAD, 0);
    try
      repeat
        InternetReadFile(hURL, @Buffer, 1024, BufferLength);
        Stream.WriteBuffer(Buffer, BufferLength);
        Application.ProcessMessages;
      until (BufferLength = 0);
      Result := Stream.DataString;
     finally
       InternetCloseHandle(hURL)
     end;
  finally
    InternetCloseHandle(hSession);
    Stream.free;
  end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  Memo1.Text := LoadFromURL('www.experts-exchange.com');
end;

Markus
0
 

Expert Comment

by:davizinx
ID: 23504838
very good, ty dude.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month10 days, 7 hours left to enroll

765 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