Hi
I need to download files from internet.Can anyone pls suggest a method how it can be done ?
Thanks
Hi
I need to download files from internet.Can anyone pls suggest a method how it can be done ?
Thanks
If the files are located on a FTP server you may use samples\gallery\icopyfil\icopyfil.prg
Hi
Thanks Antonio.I am not sure whether they are on ftp server.I have to paste the complete path in URL address bar and the file gets downloaded.I have to provide the date for which the file is required and the file should be downloaded.Pls advice how this can be done
Thanks
Rajeev,
Please show a URL sample like the ones that you are using.
Hi Antonio
The URL below will download EOD prices of shares
/*
Purpose: Example of how to get the HTML code for a web page
Date : 01/04/05
Notes : You must create a main window to use a socket.
I had to fix a bug in the TWebClient class, new method. It was returning nil
instead of self. TWEBCLIE.PRG was dated 11/11/1999 (came with FWH 2.4 July 2003).
The function ProcessPage does not return the code since it is collected in a socket
which may still be running when the function exits. You have to process the code
by assigning a function call to oWeb:oSocket:bClose
James Bott, jbott@compuserve.com
*/
#include "fivewin.ch"
#define FALSE .F.
#define TRUE .T.
function main()
local oWnd
define window oWnd
activate window oWnd ;
on init ProcessPage("http://www.nseindia.com/content/historical/EQUITIES/2006/APR/cm24APR2006bhav.csv")
return nil
function ProcessPage(cURL)
local oWeb
local cHTML:="" // contains HTML code
local cSite:=""
local cPage:=""
if left(upper(cURL),7) = "HTTP://"
cURL:= right(cURL,len(cURL)-7)
endif
cSite:= left(cURL, at("/",cURL)-1 )
cPage:= right(cURL,len(cURL)-at("/",cURL))
//msgInfo(cSite,"cSite")
//msgInfo(cPage,"cPage")
oWeb := TWebClient():New()
oWeb:oSocket:Cargo := FALSE
oWeb:bOnConnect = {|oWClient| oWClient:oSocket:Cargo := TRUE}
oWeb:bOnRead = {|cData| if(valtype(cData) == "C", cHTML += cData, )}
oWeb:Connect(cSite)
//msgInfo(cHTML)
// Keep trying to connect
while ! oWeb:oSocket:Cargo
WaitMessage()
SysRefresh()
enddo
// msgInfo("Connected to site")
oWeb:GetPage( cPage )
// Assign function to process code
oWeb:oSocket:bClose = {|self| ::end(), self:=Nil, Process(cHTML) }
//oWeb:oSocket:close()
sysrefresh()
//msgInfo("page collected")
//msgInfo(cHTML)
return nil
// Process the HTML code
function Process(cHTML)
msgInfo(cHTML,"HTML code") // for testing only
// Process the code here--save to file, extract data, etc.
return nil
// eof
//----------------------------------------------------------------------------//Hi James
Thanks for the program supplied for downloading the info from web page.When I ran that program I got the info displayed in a window.When I clicked the close button of the window I got following error message "Error BASE/1209 String Overflow: + from Errorsys,line:0".Pls advice how to overcome this problem.Is it occuring because info is more than 65K . I have noticed the CSV file size is between 65K-68K.If this is the case pls advice how to overcome this.
Digressing from the subject.A few years back when I had posted my first query on fivewin newsgroup you had answered it and introduced me to the concept of "Paying it forward".Eventhough I have not contributed anything to fivewin I try to reply to posts on other forums which I visit.It does give mental satisfaction when you help other people.
With Best Wishes
Rajeev Chavan
Rajeev,
You need to migrate your application to FiveWin for Harbour (32 bits) where you can manage files as large as needed. In a week or less you may have it working with FWH.
Thanks for the program supplied for downloading the info from web page.When I ran that program I got the info displayed in a window.When I clicked the close button of the window I got following error message "Error BASE/1209 String Overflow: + from Errorsys,line:0".Pls advice how to overcome this problem.Is it occuring because info is more than 65K . I have noticed the CSV file size is between 65K-68K.If this is the case pls advice how to overcome this.
Hi Jeff
Will do as suggested by you.I am really getting confused should I go for Harbor or xHarbor ? Pls advice
Thanks
Rajeev Chavan
Rajeev,
xharbour is more popular, but both Harbour and xharbour work very well.
If you don't use xharbour extensions, then you may be able to build your application with both compilers and decide for yourself which one to use.
Hi Jeff
Thanks for the guidance.The problem I am getting is the variable would'nt hold more than 65K.Does TTxtFile class contain a way to overcome the 65K limit ? Pls advice.
Thanks
Hi antonio
Thanks for the info.I will try it
Rajeev Chavan
Rajeev,
>The problem I am getting is the variable would'nt hold more than 65K.Does TTxtFile class contain a way to overcome the 65K limit ?
Only by going to 32bit. 65K is the 16bit limit.
James
Hi Jeff
What is the limit for 32bit ? In case the file I am downloading is huge
Thanks
Rajeev chavan
The limit is the available memory.
EMG