Download file from WWW

HMG Samples and Enhancements

Moderator: Rathinagiri

User avatar
serge_girard
Posts: 1527
Joined: Sun Nov 25, 2012 2:44 pm
Location: Belgium
Has thanked: 146 times
Been thanked: 21 times
Contact:

Re: Download file from WWW

Post by serge_girard » Fri Mar 17, 2017 7:54 am

Hi,

Problem of course is when they change layout of pages !

Serge

edk
Posts: 34
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland
Has thanked: 4 times
Been thanked: 12 times

Re: Download file from WWW

Post by edk » Fri Mar 17, 2017 7:59 am

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: 34
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland
Has thanked: 4 times
Been thanked: 12 times

Re: Download file from WWW

Post by edk » Fri Mar 17, 2017 7:59 am

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: 54
Joined: Fri Feb 10, 2017 4:12 am
Has thanked: 18 times
Been thanked: 1 time

Re: Download file from WWW

Post by RPC » Fri Mar 17, 2017 7:06 pm

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: 34
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland
Has thanked: 4 times
Been thanked: 12 times

Re: Download file from WWW

Post by edk » Fri Mar 17, 2017 9:57 pm

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: 54
Joined: Fri Feb 10, 2017 4:12 am
Has thanked: 18 times
Been thanked: 1 time

Re: Download file from WWW

Post by RPC » Sat Mar 18, 2017 7:42 pm

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: 2631
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 59 times
Been thanked: 23 times
Contact:

Re: Download file from WWW

Post by mol » Sun Mar 19, 2017 8:21 am

Hi Edward!
Maybe you know, how to detect proxy server?
Your samples and help are very good :)

edk
Posts: 34
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland
Has thanked: 4 times
Been thanked: 12 times

Re: Download file from WWW

Post by edk » Sun Mar 19, 2017 10:15 am

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.

User avatar
mol
Posts: 2631
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 59 times
Been thanked: 23 times
Contact:

Re: Download file from WWW

Post by mol » Sun Mar 19, 2017 10:45 am

Something wrong?
dużo zdrowia!

edk
Posts: 34
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland
Has thanked: 4 times
Been thanked: 12 times

Re: Download file from WWW

Post by edk » Tue Mar 21, 2017 1:34 pm

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

Who is online

Users browsing this forum: No registered users and 1 guest