Page 3 of 5

Re: Download file from WWW

Posted: Wed Mar 08, 2017 3:15 pm
by RPC
Hi mlnr
Thanks for the code. It works !!!
I can download from the net now :D
I have another problem. I want to download some information from the web page.
It means I have to "read" the page from the program and download that information.
Is it possible :?:
Thanks once again for your help.

Re: Download file from WWW

Posted: Wed Mar 08, 2017 3:47 pm
by hmgaams57
Hi mlnr
The program works fine but it would be even better
if there is way to add a progress bar and the ability
to resume downloads without starting from the beginning
after interruption.

Re: Download file from WWW

Posted: Thu Mar 09, 2017 1:22 pm
by mlnr
hmgaams57 wrote: Wed Mar 08, 2017 3:47 pm Hi mlnr
The program works fine but it would be even better
if there is way to add a progress bar and the ability
to resume downloads without starting from the beginning
after interruption.
Hi hmgaams57

You can get the file size

Code: Select all

oSoap:getResponseHeader("Content-Length")
and try to watch the download state. Some info here

https://msdn.microsoft.com/en-us/librar ... s.85).aspx
RPC wrote: Wed Mar 08, 2017 3:15 pm Hi mlnr
Thanks for the code. It works !!!
I can download from the net now :D
I have another problem. I want to download some information from the web page.
It means I have to "read" the page from the program and download that information.
Is it possible :?:
Thanks once again for your help.
Hi RPC,

Sorry, i cannot help you. Maybe someone has an information.

Re: Download file from WWW

Posted: Fri Mar 10, 2017 7:26 am
by RPC
Hi mlnr
Its OK if you cant help in "reading" webpage
At least now I can download links.
Thank you

Re: Download file from WWW

Posted: Fri Mar 10, 2017 10:29 am
by edk
Hi RPC.
Try this: C:\hmg.3.4.3\HARBOUR\contrib\hbtip\tests\loadhtml.prg
But, if you need to read pages from https, you must include SSL suport

Code: Select all

#require "hbssl"
REQUEST __HBEXTERN__HBSSL__

IF !tip_SSL()
	MsgStop("Required SSL")
     Return
ENDIF
oHttp := TIPClientHTTP():new( "https://www.google.com/search", .F. )
You need also in hbc:

Code: Select all

libs=hbssl
libs=libeay32
libs=ssleay32
Libs=hbtip
Include in hbp:

Code: Select all

hbssl.hbc
And most important: DLLs
ssl_dll.7z
(566.58 KiB) Downloaded 383 times
Edward.

Re: Download file from WWW

Posted: Fri Mar 10, 2017 11:06 am
by serge_girard
Thx Edward!

Is there a specific folder for the DLL needed or just where the EXE is located?

Re: Download file from WWW

Posted: Fri Mar 10, 2017 12:27 pm
by edk
Just where EXE is located.
Edward.

Re: Download file from WWW

Posted: Sat Mar 11, 2017 6:49 pm
by RPC
edk wrote: Fri Mar 10, 2017 10:29 am Hi RPC.
Try this: C:\hmg.3.4.3\HARBOUR\contrib\hbtip\tests\loadhtml.prg
But, if you need to read pages from https, you must include SSL suport

Code: Select all

#require "hbssl"
REQUEST __HBEXTERN__HBSSL__

IF !tip_SSL()
	MsgStop("Required SSL")
     Return
ENDIF
oHttp := TIPClientHTTP():new( "https://www.google.com/search", .F. )
You need also in hbc:

Code: Select all

libs=hbssl
libs=libeay32
libs=ssleay32
Libs=hbtip
Include in hbp:

Code: Select all

hbssl.hbc
And most important: DLLs
ssl_dll.7z
Edward.
Hi Edwards

Many thanks for the code and description.

I tried to compile, thro IDE, loadhtml.prg but got error BASE/1004 No Exported method: AS

Unfortunately I am quite dumb in understanding all this.

I have to download data from following site
https://www.nseindia.com/products/conte ... x_data.htm

Time period is 10 march 2017 to 10 march 2017 and click Get Data button. Then you will get follo info

Date : 10-Mar-2017 | Open : 8953.70 | High : 8975.70 | Low : 8903.95 | Close : 8934.55 | Shares Traded : 157419999 | Turnover(Rs Cr) : 7385.28

There is also a hyperlink - Download file in CSV format - towards right side corner of the information downloaded. Clicking on this downloads the above information in a CSV file.

It is this information which I want to download. I notice it is a https page. Could you please send a program to download the info in a CSV/text file. I would be very grateful.

Thanks
RPC

Re: Download file from WWW

Posted: Sun Mar 12, 2017 6:06 am
by mol
Hi!
Sorry for delay, but last week I was absent without internet.
I have no limitations in type of downloaded file, but this solution has a problem with some proxy servers.
Put a description of error which you geet.

Hi Gabor! Your solution with SOAP is very interesting. Can you add to your code lines, which changes http AGENT to Mozilla or IE?

Re: Download file from WWW

Posted: Sun Mar 12, 2017 8:40 am
by RPC
mol wrote: Sun Mar 12, 2017 6:06 am Hi!
Sorry for delay, but last week I was absent without internet.
I have no limitations in type of downloaded file, but this solution has a problem with some proxy servers.
Put a description of error which you geet.

Hi Gabor! Your solution with SOAP is very interesting. Can you add to your code lines, which changes http AGENT to Mozilla or IE?
Hi mol
Its ok if you couldn't answer earlier. You have been very helpful and I appreciate that.
Following is the screen shot of the error
Error - Download - mol.png
Error - Download - mol.png (32.64 KiB) Viewed 7040 times
I put following url in window
https://www.nseindia.com/content/histor ... av.csv.zip
and save to was a.zip filename, when I click the download button I got above error message.
Thanks