HTTP를 사용하여 파일을 다운로드하고 싶습니다. 어떻게해야합니까?CA-VO로 파일을 다운로드하는 방법
0
A
답변
1
나는이 더 조사하고 그 결과로 지난 주부터 내 제안을 다시 주문한 :
VO의 '인터넷'라이브러리의 클래스 'CHttp는'방법 GETFILE (the VO 2.5 "what's new" has a brief description on page 10)가 있습니다. 나는 그것을 시도하지 않았다. 당신은 아마 이런 식으로 뭔가 할 것입니다 :
local oSession as CHttp local lSuccess as logic oSession := CHttp{} oSession:ConnectRemote("foo.example.com") // Server domain name lSuccess := oSession:GetFile("bar/baz.pdf",; // Remote filename "c:\temp\baz.pdf",; // Local filename lFailIfAlreadyExists) oSession:CloseRemote() // If lSuccess, the file should be downloaded to cLocalFileName. // I don't know whether the filename arguments should use/or \ for directory separators.
을 나는 또 다른 방법은 파일을 다운로드하는 외부 프로그램을 호출하기 위해 Windows
ShellExecute
기능을 사용하는 것입니다 생각합니다. ShellExecute here의 예를 발견했습니다. 나는 VO 컴파일러 (또는 도움 파일!)가 없기 때문에 이것을 시도하지 않았다. 이 방법이 좋은지 아닌지 잘 모르겠습니다. 부적절한 파일 이름을 제공하여 악성 명령을 실행하려는 사람들이 안전한지 여부를 알지 못합니다. 하지만 다음은 일 수도 있고 일 수 있다고 생각합니다. 이 파일을 다운로드하는 데 사용되는 경로에curl.exe
(curl 참조) 프로그램이 있다고 가정합니다. 대신curl.exe
의 전체 경로가 필요할 수 있습니다. 나는local cParameters as string local cURL:="http://www.example.com/interesting.htm" as string local cLocalFile:="savefile.html" as string cParameters := "-o "+cLocalFile+" "+cURL ShellExecute(NULL /*Window handle*/,; String2PSZ("open"),; String2PSZ("curl.exe"),; String2PSZ(cParameters),; NULL_PTR /* lpDirectory */,; SW_SHOWNORMAL)
도 the MSDN page for ShellExecute 참조 (난 당신이
lpDirectory
라고 표시된 매개 변수에 작업 디렉토리를 지정할 수 있습니다 생각) 파일을 기본적으로 저장 될 위치를 모르겠어요.는 외부 응용 프로그램
App:Run(cCommand)
이있을 나타납니다