checking an url

Post Reply
User avatar
driessen
Posts: 1239
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

checking an url

Post by driessen »

Hello,

To check an url, I use this function :

Code: Select all

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. 21.01 - Harbour 3.2.0 (October 2020) - xHarbour Builder (January 2020) - Bcc7
User avatar
Rick Lipkin
Posts: 2397
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: checking an url

Post by Rick Lipkin »

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
FranciscoA
Posts: 1964
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: checking an url

Post by FranciscoA »

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.
https://forums.fivetechsupport.com/view ... er#p225509
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh1204-MySql-TMySql
Horizon
Posts: 997
Joined: Fri May 23, 2008 1:33 pm

Re: checking an url

Post by Horizon »

Hi,

Is there any solution?
Regards,

Hakan ONEMLI

Harbour & VS 2019 & FWH 20.12
User avatar
cnavarro
Posts: 5792
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: checking an url

Post by cnavarro »

You are using hbtip.lib in your example, right?
You need the lib hbtipssl.lib to support https sites.
C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
Natter
Posts: 524
Joined: Mon May 14, 2007 9:49 am

Re: checking an url

Post by Natter »

URLDOWNLOADTOFILE()

or

ohttp:= CreateObject( "MSXML2.XMLHTTP" )
ohttp:Open( "GET", "https://....", 1)
Horizon
Posts: 997
Joined: Fri May 23, 2008 1:33 pm

Re: checking an url

Post by Horizon »

Thank you,

URLDOWNLOADTOFILE() function solved my problem.
Regards,

Hakan ONEMLI

Harbour & VS 2019 & FWH 20.12
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: checking an url

Post by nageswaragunupudi »

Can you please try this simple function?

Code: Select all

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

G. N. Rao.
Hyderabad, India
Horizon
Posts: 997
Joined: Fri May 23, 2008 1:33 pm

Re: checking an url

Post by Horizon »

nageswaragunupudi wrote:Can you please try this simple function?

Code: Select all

cRet := WebPageContents( cUrl )
if Empty( cRet )
   ? "Invalid URL"
else
   ? cRet
endif
 
Thank Mr. Rao,

This functions also works successfully.
Regards,

Hakan ONEMLI

Harbour & VS 2019 & FWH 20.12
Horizon
Posts: 997
Joined: Fri May 23, 2008 1:33 pm

Re: checking an url

Post by Horizon »

nageswaragunupudi wrote:Can you please try this simple function?

Code: Select all

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 & VS 2019 & FWH 20.12
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: checking an url

Post by nageswaragunupudi »

Is there an option to show progress of download?
No.
Regards

G. N. Rao.
Hyderabad, India
FWExplorer
Posts: 83
Joined: Fri Aug 09, 2013 12:43 am

Re: checking an url

Post by FWExplorer »

Can this be used, to check the validity of sites with credentials?
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: checking an url

Post by Antonio Linares »

regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply