FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour checking an url
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
checking an url
Posted: Fri Oct 23, 2020 08:16 AM
Hello,

To check an url, I use this function :
Code (fw): Select all Collapse
STATIC FUNCTION wfReadURL(cUrl,cNr,dUrl)

   LOCAL cFile  := SUBSTR(cUrl,RAT("/",cUrl)+1)
   LOCAL cExist := .F.

   LOCAL oUrl,oCli

   DEFAULT(dUrl,"")
   
   cUrl := LOWER(cUrl)
   
   BEGIN SEQUENCE

         oUrl := TUrl():New(cUrl)
         IF EMPTY(oUrl) ; BREAK ; ENDIF
         oCli := TIPClientHttp():New(oUrl)
         IF EMPTY(oCli) ; BREAK ; ENDIF
         IF !oCli:Open() ; BREAK ; ENDIF
         IF !oCli:ReadToFile(cFile) ; BREAK ; ENDIF
         IF PAR->TESTNOTRY
            cExist := "OK" $ UPPER(oCli:cReply)
         ELSE
            TRY
               cExist := "OK" $ UPPER(oCli:cReply)
            CATCH
               cExist := .T.
            END
         ENDIF
         oCli:Close()

   END SEQUENCE
  
RETURN(cExist)
Why is this function working fine while using an url starting with "http://" and why is it not working with "https://"?
In that case I got an error on the TipClienthttp:new() function.
Anyone any idea?
Thank you.

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: checking an url
Posted: Fri Oct 23, 2020 12:56 PM
Michael

I googled the difference between Http and Https ..


HTTPS is HTTP with encryption. The only difference between the two protocols is that HTTPS uses TLS (SSL) to encrypt normal HTTP requests and responses. As a result, HTTPS is far more secure than HTTP. A website that uses HTTP has http:// in its URL, while a website that uses HTTPS has https://.


Rick Lipkin
Posts: 2170
Joined: Fri Jul 18, 2008 01:24 AM
Re: checking an url
Posted: Fri Oct 23, 2020 07:31 PM
driessen wrote:
 [/code]Why is this function working fine while using an url starting with "http://" and why is it not working with "https://"?
In that case I got an error on the TipClienthttp:new() function.
Anyone any idea?
Thank you.


Maybe this can help you.
viewtopic.php?f=6&t=37703&p=225509&hilit=nada+que+ver#p225509
Francisco J. Alegría P.

Chinandega, Nicaragua.



Fwxh-MySql-TMySql
Posts: 1387
Joined: Fri May 23, 2008 01:33 PM
Re: checking an url
Posted: Tue Dec 01, 2020 10:20 AM

Hi,

Is there any solution?

Regards,



Hakan ONEMLI



Harbour & MSVC 2022 & FWH 23.06
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: checking an url
Posted: Tue Dec 01, 2020 01:40 PM

You are using hbtip.lib in your example, right?
You need the lib hbtipssl.lib to support https sites.

Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: checking an url
Posted: Tue Dec 01, 2020 02:28 PM

URLDOWNLOADTOFILE()

or

ohttp:= CreateObject( "MSXML2.XMLHTTP" )
ohttp:Open( "GET", "https://....", 1)

Posts: 1387
Joined: Fri May 23, 2008 01:33 PM
Re: checking an url
Posted: Wed Dec 02, 2020 07:38 AM

Thank you,

URLDOWNLOADTOFILE() function solved my problem.

Regards,



Hakan ONEMLI



Harbour & MSVC 2022 & FWH 23.06
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: checking an url
Posted: Wed Dec 02, 2020 08:34 AM
Can you please try this simple function?
Code (fw): Select all Collapse
cRet := WebPageContents( cUrl )
if Empty( cRet )
   ? "Invalid URL"
else
   ? cRet
endif
Regards



G. N. Rao.

Hyderabad, India
Posts: 1387
Joined: Fri May 23, 2008 01:33 PM
Re: checking an url
Posted: Wed Dec 02, 2020 08:52 AM
nageswaragunupudi wrote:Can you please try this simple function?
Code (fw): Select all Collapse
cRet := WebPageContents( cUrl )
if Empty( cRet )
   ? "Invalid URL"
else
   ? cRet
endif


Thank Mr. Rao,

This functions also works successfully.
Regards,



Hakan ONEMLI



Harbour & MSVC 2022 & FWH 23.06
Posts: 1387
Joined: Fri May 23, 2008 01:33 PM
Re: checking an url
Posted: Wed Dec 09, 2020 01:43 PM
nageswaragunupudi wrote:Can you please try this simple function?
Code (fw): Select all Collapse
cRet := WebPageContents( cUrl )
if Empty( cRet )
   ? "Invalid URL"
else
   ? cRet
endif


Hi Mr. Rao,

Is there an option to show progress of download?

Thanks.
Regards,



Hakan ONEMLI



Harbour & MSVC 2022 & FWH 23.06
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: checking an url
Posted: Wed Dec 09, 2020 03:11 PM
Is there an option to show progress of download?


No.
Regards



G. N. Rao.

Hyderabad, India
Posts: 103
Joined: Fri Aug 09, 2013 12:43 AM
Re: checking an url
Posted: Sat Dec 19, 2020 11:43 PM

Can this be used, to check the validity of sites with credentials?

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: checking an url
Posted: Tue Dec 29, 2020 05:10 PM
regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion