Download file from WWW

HMG Samples and Enhancements

Moderator: Rathinagiri

User avatar
serge_girard
Posts: 3161
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: Download file from WWW

Post by serge_girard »

Hi,

Problem of course is when they change layout of pages !

Serge
There's nothing you can do that can't be done...
edk
Posts: 909
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: Download file from WWW

Post by edk »

RPC wrote: Thu Mar 16, 2017 8:38 pm (...)
Could you tell me what should I read on the internet, perhaps a quick tutorial on "querying", which would teach me. :?:
If it is handy, could you please point out to some links. :idea:

I always use the help of Uncle Google ;)
Last edited by edk on Fri Mar 17, 2017 8:00 am, edited 1 time in total.
edk
Posts: 909
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: Download file from WWW

Post by edk »

serge_girard wrote: Fri Mar 17, 2017 7:54 am Hi,

Problem of course is when they change layout of pages !

Serge
+1
The solution may be webApi, if it exists.
RPC
Posts: 281
Joined: Fri Feb 10, 2017 4:12 am
DBs Used: DBF

Re: Download file from WWW

Post by RPC »

Hi Edward,
I tried google but could not find the specific information on querying.
I will keep trying though, thanks.
One last thing. How can we check if we are connected to internet or not. In method 2 you have following code
// Connect to the HTTPs server
IF ! oHttp2:open( url+cGet )
msgbox( "Connection error:"+oHttp2:lastErrorMessage())
Return
ENDIF
but the above message is not displayed when I switched my internet off.
Can you pls tell how can we check if we are connected or not.
Many thanks
edk
Posts: 909
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: Download file from WWW

Post by edk »

Queries depend on how the system is built on the side of the host. If the publisher does not provide documentation for general queries, please consult the source code html and see how they are called queries from the website.
Maybe it will be a little helpful: https://perishablepress.com/how-to-writ ... arameters/

To checking your Internet connection, try to use this function:

Code: Select all

IF !isInternet()
	MsgStop("No Internet connection")
	Return
ENDIF
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
FUNCTION isInternet( nTimeOut )
	Local aAddr:=hb_socketResolveINetAddr( "www.google.com" , 80 )
	Local socket:=hb_socketOpen()
	Local lIsNet
	Default nTimeOut:=2000
	lIsNet:=!EMPTY( aAddr ) .AND. hb_socketConnect( socket , aAddr, nTimeOut )
	hb_socketClose( socket )
RETURN lIsNet
Of course, this will work properly until google.com is alive. :lol:

I know from experience that hbTip may have some bugs, and sometimes did not work as we expect. ;)
RPC
Posts: 281
Joined: Fri Feb 10, 2017 4:12 am
DBs Used: DBF

Re: Download file from WWW

Post by RPC »

Hi Edward,
Thanks for the code for checking internet connection. Its working :)
Also many thanks for the link where I can learn about querying. Looks like exhaustive information.
I can't thank you enough for being so patient in teaching and explaining me all the intricacies of downloading from internet.
Many thanks for everything. :D
RPC
User avatar
mol
Posts: 3718
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: Download file from WWW

Post by mol »

Hi Edward!
Maybe you know, how to detect proxy server?
Your samples and help are very good :)
edk
Posts: 909
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: Download file from WWW

Post by edk »

I'm sorry Marek, but I did not need to use a proxy and do not have a ready solution for you.
So I quickly found on the description in C.
http://stackoverflow.com/questions/2025 ... y-settings
and from msdn
https://msdn.microsoft.com/pl-pl/librar ... s.85).aspx
I don't now how to check it out, because I'm with my kid in the clinic for a few days.
Regards, Edward.
edk
Posts: 909
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: Download file from WWW

Post by edk »

mol wrote: Sun Mar 19, 2017 8:21 am Hi Edward!
Maybe you know, how to detect proxy server?
Your samples and help are very good :)
This may be helpful:
https://github.com/vszakats/harbour-cor ... _proxy.prg
https://github.com/vszakats/harbour-cor ... n_proxyc.c
https://github.com/vszakats/harbour-cor ... /proxy.prg

Edward.
Post Reply