HTML 긁어오는 프로그램 소스

31367 
Created at 2006-09-28 04:35:09 
146   0   0   0  
Your first task is to create a Delphi function used to download a file from the Internet. One way of achieving this task is to use the WinInet API calls. Delphi gives us full access to the WinInet API (wininet.pas) which we can use to connect to and retrieve files from any Web site that uses either Hypertext Transfer Protocol (HTTP) or File Transfer Protocol (FTP). I've already written an article that describes this technique: Get File From the Net.

Another approach, if you have Delphi 6, is to use the TDownloadURL object. The TDownloadURL object, defined in ExtActns.pas unit, is designed for saving the contents of a specified URL to a file. Here's the code that uses the TDownloadURL to download the "What's New and Hot" page from this site.


uses extactns;  // <- must be added //

function Download_HTM(const sURL, sLocalFileName:string): boolean;
begin
Result:=True;
with TDownLoadURL.Create(nil) do
try
   URL:=sURL;
   Filename:=sLocalFileName;
   try
     ExecuteTarget(nil);
   except
     Result:=False
   end;
finally
   Free;
end;
end;





This function, Download_HTM, downloads a file from the URL specified in the sURL parameter, and saves this file locally under a sLocalFileName name. The function returns True if it succeeds, False otherwise. Of course, this function is to be called from the Button1 OnClick event handler. You can see the code below. Note that, locally, the file is saved as c: emp_adp.newandhot.

procedure TForm1.Button1Click(Sender: TObject);
const
ADPNEWHOTURL='http://delphi.about.com/cs/newandhot/index.htm';
TmpFileName='c: emp_adp.newandhot';
begin
if NOT Download_HTM(ADPNEWHOTURL,TmpFileName) then
begin
   ShowMessage('Error in HTML file download');
   Exit;
end;

{
more code to be added
}

end;






Note: In the process of downloading a file, the TDownloadURL periodically generates an OnDownloadProgress event, so that you can provide users with feedback about the process. I'll leave this for you to implement.


Tags: capture grab 스크랩 윈도우즈 Share on Facebook Share on X

◀ PREVIOUS
작업관리자에 프로그램 안뜨게 하기
▶ NEXT
PHP로 객체지향 프로그래밍 하는 방법
  댓글 0
로그인을 하시면 댓글을 등록 할 수 있습니다.
SIMILAR POSTS

파일에서 한줄만 읽어다 return 해주는 소스 (created at 2006-09-28)

작업관리자에 프로그램 안뜨게 하기 (created at 2006-09-28)

String Find Function (StrFnd) (created at 2006-09-28)

Toolbar에서 Icon 없애기 (created at 2006-09-28)

웹브라우져가 떠서 웹페이지 보이게 하는 소스 (created at 2006-09-28)

ActiveX에 다이얼로그 붙이기 (created at 2006-09-28)

드라이브 문자 알아내는 소스 (created at 2006-09-28)

모달리스 다이얼로그의 종료 버튼을 클릭했을 때 종료가 안될때... (created at 2006-09-28)

ActiveX에서 바이너리 데이터 파라메터로 안깨지게 받는법 (created at 2006-09-28)

ListCtrl에서 아이템 추가하기 예제 (created at 2006-09-28)

DirectShow - NULL Rendering Example (created at 2006-09-28)

Broadcast를 이용한 Application 종료 (created at 2006-09-28)

IE Control을 사용하여 만든 어플리케이션에서 javascript로 어플리케이션에 정의된 함수 호출하는 방법 (created at 2006-09-28)

윈도우 옮기는 API - SetWindowPos (created at 2006-09-28)

GDI+ Programming 방법 (created at 2006-09-28)

CFileDialog - File Open Example (created at 2006-09-28)

투명 윈도우 만들기 (created at 2006-09-28)

마우스로 윈도우 드래그하여 이동시키는 비기 (created at 2006-09-28)

불투명 윈도우 만들기 (created at 2006-09-28)

WinCE에서 Key Hooking하는 방법 (created at 2006-09-28)

비트맵을 배경으로 뿌리고 그 위에 컨트롤 올리는 방법 (created at 2006-09-28)

BITMAP 오브젝트에서 가로,세로 크기 알아내기 (created at 2006-09-28)

비트맵을 파일에서 로딩하는 비기 (created at 2006-09-28)

듀얼 모니터에서 Focused Monitor의 Rect 알아내기 (created at 2006-09-28)

프로그램에서 버젼(version) 정보 읽어주는 소스 (created at 2006-09-28)

RDP(Remote Desktop Protocol) Port 값 가져오고/바꿔주기 (created at 2006-09-28)

IE 패치에 따른 object, embed, applet 대처 방안 (created at 2006-09-28)

빈폴더 찾아내기 (created at 2006-09-29)

프로세스명으로 프로세스 죽이는 함수 (created at 2006-09-29)

자기자신 IP알아내기(로칼컴퓨터) (created at 2006-09-29)

GDI+ 에서 이미지 반투명 처리하기.. (created at 2006-09-29)

System Log-Off, Suspend, Reboot, Shutdown 시키기 (created at 2006-09-29)

ATL/ActiveX 에서 자바스크립트로 데이터(문자열) 보내기 (created at 2006-09-29)

wave 파일 mixing 하기. (웨이브 믹싱) (created at 2006-09-29)

File Attribute 바꾸는 방법 (created at 2006-09-29)

디렉토리 복사 루틴 (하부디렉토리까지 몽땅) (created at 2006-09-29)

디렉토리와 그 안에 있는 모든 파일 지우기 (created at 2006-09-29)

Create a standard windows shortcut file (created at 2006-09-29)

Starting an application as an icon in the system tray (created at 2006-09-29)

Extracting a Program's Version Information (created at 2006-09-29)

ShellExecute 실행 끝날때 까지 기다리기 (created at 2006-09-29)

DirectShow에서 비디오 출력 크기 조정해주기 (created at 2006-09-29)

공유폴더 찾아주기 (created at 2006-09-29)

로컬 IP 알아내기 (created at 2006-09-29)

스크린세이버 동작 못하게 막아주기 (created at 2006-09-29)

PC 셧다운 (shutdown) (created at 2006-09-29)

how to record keyboard & mouse event (created at 2006-09-29)

웹브라우져에 붙이기 위한 ActiveX 프로그래밍 방법 (created at 2006-09-29)

투명 윈도우 구현 방법 (created at 2006-09-29)

ActiveX를 Safe한 Component로 등록하는 방법 (created at 2006-09-29)

OTHER POSTS IN THE SAME CATEGORY

wave 파일 mixing 하기. (웨이브 믹싱) (created at 2006-09-29)

ATL/ActiveX 에서 자바스크립트로 데이터(문자열) 보내기 (created at 2006-09-29)

System Log-Off, Suspend, Reboot, Shutdown 시키기 (created at 2006-09-29)

GDI+ 에서 이미지 반투명 처리하기.. (created at 2006-09-29)

자기자신 IP알아내기(로칼컴퓨터) (created at 2006-09-29)

프로세스명으로 프로세스 죽이는 함수 (created at 2006-09-29)

빈폴더 찾아내기 (created at 2006-09-29)

IE 패치에 따른 object, embed, applet 대처 방안 (created at 2006-09-28)

Virtusertable (created at 2006-09-28)

웹서버 및 웹메일 설정 방법 (created at 2006-09-28)

음력-양력 변환기 (created at 2006-09-28)

PHP에서 메일 함수가 동작하지 않을때 (created at 2006-09-28)

어떤 파라메터가 넘어왔는지 알아내는 함수 (created at 2006-09-28)

웹페이지 긁어서 타이틀 뿌려주는 소스 (created at 2006-09-28)

PHP로 객체지향 프로그래밍 하는 방법 (created at 2006-09-28)

작업관리자에 프로그램 안뜨게 하기 (created at 2006-09-28)

파일 업로드 (file upload) 사이즈 늘리기 (created at 2006-09-28)

String Find Function (StrFnd) (created at 2006-09-28)

Toolbar에서 Icon 없애기 (created at 2006-09-28)

웹브라우져가 떠서 웹페이지 보이게 하는 소스 (created at 2006-09-28)

ActiveX에 다이얼로그 붙이기 (created at 2006-09-28)

드라이브 문자 알아내는 소스 (created at 2006-09-28)

모달리스 다이얼로그의 종료 버튼을 클릭했을 때 종료가 안될때... (created at 2006-09-28)

ActiveX에서 바이너리 데이터 파라메터로 안깨지게 받는법 (created at 2006-09-28)

ListCtrl에서 아이템 추가하기 예제 (created at 2006-09-28)

DirectShow - NULL Rendering Example (created at 2006-09-28)

Broadcast를 이용한 Application 종료 (created at 2006-09-28)

IE Control을 사용하여 만든 어플리케이션에서 javascript로 어플리케이션에 정의된 함수 호출하는 방법 (created at 2006-09-28)

윈도우 옮기는 API - SetWindowPos (created at 2006-09-28)

GDI+ Programming 방법 (created at 2006-09-28)

UPDATES

자리 마음에 안든다고 6급 공무원 패는 농협 조합장 (created at 2024-03-26)

85세 딸 짜장면 사주는 102세 어머니 (created at 2024-03-26)

1990년대 감각파 도둑 (created at 2024-03-26)

치매에 걸린 69살의 브루스 윌리스가 전부인 데미무어를 보고 한 말 (updated at 2024-03-22)

일제강점기가 더 살기 좋았을지도 모른다는 조수연 국민의힘 후보 - 친일파? (updated at 2024-03-14)

성일종 인재육성 강조하며 이토 히로부미 언급 - 인재 키운 선례? (updated at 2024-03-13)

경제는 대통령이 살리는 것이 아닙니다 라던 윤석열대통령 - 상황 안좋아지자 여러 전략을 펼쳤지만, 부작용 속출했던 2024년의 봄 (updated at 2024-03-13)

극빈의 생활을 하고 배운것이 없는 사람은 자유가 뭔지도 모를 뿐 아니라 왜 개인에게 필요한지에 대한 필요성을 못느낀다는 윤석열 대통령 (updated at 2024-03-08)

조선일보를 안본다는 사람들이 말하는 그 이유 - 천황폐하, 전두환 각하, 김일성 장군 만세? (created at 2024-03-07)

광폭타이어를 장착하면 성능이 좋아질거라는 착각 (updated at 2024-03-03)

면허시험장에서 면허갱신하면 하루만에 끝나나? (updated at 2024-03-03)

신한은행/신한투자증권 금융거래 종합보고서 다운로드 방법 (updated at 2024-02-26)

100년 된 일본 장난감 회사가 내놓은 변신 기술에 난리난 과학계 (created at 2024-02-26)

알리에서 발견한 한글 지원하는 가성비 쩌는 무선 기계식키보드 (updated at 2024-02-25)

쌍팔년도가 1988년인줄 알았던 1인 (updated at 2024-02-23)

이쁜 색으로 변신한 테슬라 사이버트럭 (created at 2024-02-23)

2024년 카타르 아시안컵 4강전 전날 한국 대표팀 내부에 있었던 이강인의 폭주 (updated at 2024-02-21)

강릉 맛집 지도 (updated at 2024-02-20)

간이 안좋을 때 나타나는 증상 20가지 (updated at 2024-02-20)

배설물을 이용하여 일본에 저항했던 독립운동가 조명하 (updated at 2024-02-20)

요건 몰랐지롱? 이순신을 사랑한 외국인 (created at 2024-02-20)

원빈도 머리빨 (created at 2024-02-19)

대표적인 대한민국의 미남배우 중 하나인 원빈 (created at 2024-02-19)

백제의 건국 시조 온조왕 (updated at 2024-02-19)

700년동안 대한민국 고대국가의 한축이었던 백제시대 (created at 2024-02-19)

대머리들에게 주는 대머리의 조언 (created at 2024-02-17)

일본의 여성 락그룹 프린세스 프린세스의 "다이아몬드" (created at 2024-02-17)

결혼식 직전 연락두절된 신랑 (created at 2024-02-17)

대한민국 축구팀 파문으로 인해 중국 소셜미디어까지 등장한 탁구 전도사 이강인 (updated at 2024-02-16)

조국의 반격으로 흥미진진하게 흘러가는 한국의 정치판 - 데뷰와 동시에 한동훈 장관에게 던진 4개의 질문 (updated at 2024-02-15)

2024년 카타르 아시안컵 4강전 전날 내분사태로 갑자기 회자되는 이승우선수의 친화력 (created at 2024-02-15)

카카오뱅크 금융거래종합보고서/잔액증명서/거래내역서 발급 방법 (created at 2024-02-14)

아이가 최고의 스승이었다 (created at 2024-02-13)

이제는 국민 유행어로 등극한 한동훈의 "싫으면 시집가" (updated at 2024-02-13)

설 연휴 잔소리 메뉴판 - 이제 잔소리 하기전에 요금부터... (updated at 2024-02-10)

로버트 드니로의 70년 전 모습 (created at 2024-02-08)

카메라 어플로 만들어본 슈퍼걸 - 엄... 최종 작품은 왠지... (created at 2024-02-08)

앞트임 하고 새롭게 태어난 대한민국의 젊은 용사 (created at 2024-02-08)

비가 억수로 내리던 2024년의 2월 어느날 캘리포니아의 밤 카니예 웨스트와 그의 아나 비앙카 센소리 (updated at 2024-02-08)

스케방형사 1화 - 수수께끼의 전학소녀사키 (created at 2024-02-05)

백제와 일본의 교류가 가장 활발했던 시기는 근초고왕 시대 (created at 2024-02-05)

일에 찌들은 아빠가 꿈에서 깨어나지 않자 구출해주는 짱구 (created at 2024-02-03)

이제는 할아버지가 된 휴 그랜트(Hugh Grant)가 블랙핑크 콘서트에 다녀온 후 소감 (created at 2024-02-03)

다시 한번 감상해보는 추억의 날리면 패러디 (updated at 2024-02-01)

25년간 노예로 살다가 돌아온 남동생 (created at 2024-02-01)

가까우면서도 멀게 느껴지는 나라 일본 (created at 2024-02-01)

친구와 비교하다가 이혼하게 된 부부 (created at 2024-02-01)

요꼬 미나미노의 바람의 마도리걸(風のマドリガル) (created at 2024-01-30)

옛날 어린이들이 신문을 챙겨봤던 이유 (created at 2024-01-30)

Remaster된 요꼬 미나미노(南野陽子)의 판도라의 연인(パンドラの恋人) (updated at 2024-01-30)