checking an url

checking an url

Postby driessen » Fri Oct 23, 2020 8:16 am

Hello,

To check an url, I use this function :
Code: Select all  Expand view
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. 24.02 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc77
User avatar
driessen
 
Posts: 1396
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: checking an url

Postby Rick Lipkin » 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
User avatar
Rick Lipkin
 
Posts: 2616
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: checking an url

Postby FranciscoA » Fri Oct 23, 2020 7: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
User avatar
FranciscoA
 
Posts: 2110
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: checking an url

Postby Horizon » Tue Dec 01, 2020 10:20 am

Hi,

Is there any solution?
Regards,

Hakan ONEMLI

Harbour & MSVC 2022 & FWH 23.04
Horizon
 
Posts: 1288
Joined: Fri May 23, 2008 1:33 pm

Re: checking an url

Postby cnavarro » Tue Dec 01, 2020 1: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
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: checking an url

Postby Natter » Tue Dec 01, 2020 2:28 pm

URLDOWNLOADTOFILE()

or

ohttp:= CreateObject( "MSXML2.XMLHTTP" )
ohttp:Open( "GET", "https://....", 1)
Natter
 
Posts: 1120
Joined: Mon May 14, 2007 9:49 am

Re: checking an url

Postby Horizon » Wed Dec 02, 2020 7:38 am

Thank you,

URLDOWNLOADTOFILE() function solved my problem.
Regards,

Hakan ONEMLI

Harbour & MSVC 2022 & FWH 23.04
Horizon
 
Posts: 1288
Joined: Fri May 23, 2008 1:33 pm

Re: checking an url

Postby nageswaragunupudi » Wed Dec 02, 2020 8:34 am

Can you please try this simple function?
Code: Select all  Expand view

cRet := WebPageContents( cUrl )
if Empty( cRet )
   ? "Invalid URL"
else
   ? cRet
endif
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10248
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: checking an url

Postby Horizon » Wed Dec 02, 2020 8:52 am

nageswaragunupudi wrote:Can you please try this simple function?
Code: Select all  Expand view

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.04
Horizon
 
Posts: 1288
Joined: Fri May 23, 2008 1:33 pm

Re: checking an url

Postby Horizon » Wed Dec 09, 2020 1:43 pm

nageswaragunupudi wrote:Can you please try this simple function?
Code: Select all  Expand view

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.04
Horizon
 
Posts: 1288
Joined: Fri May 23, 2008 1:33 pm

Re: checking an url

Postby nageswaragunupudi » Wed Dec 09, 2020 3:11 pm

Is there an option to show progress of download?


No.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10248
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: checking an url

Postby FWExplorer » Sat Dec 19, 2020 11:43 pm

Can this be used, to check the validity of sites with credentials?
FWExplorer
 
Posts: 100
Joined: Fri Aug 09, 2013 12:43 am

Re: checking an url

Postby Antonio Linares » Tue Dec 29, 2020 5:10 pm

regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 75 guests