Page 1 of 1

checking an url

Posted: Fri Oct 23, 2020 8:16 am
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.

Re: checking an url

Posted: Fri Oct 23, 2020 12:56 pm
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

Re: checking an url

Posted: Fri Oct 23, 2020 7:31 pm
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

Re: checking an url

Posted: Tue Dec 01, 2020 10:20 am
by Horizon
Hi,

Is there any solution?

Re: checking an url

Posted: Tue Dec 01, 2020 1:40 pm
by cnavarro
You are using hbtip.lib in your example, right?
You need the lib hbtipssl.lib to support https sites.

Re: checking an url

Posted: Tue Dec 01, 2020 2:28 pm
by Natter
URLDOWNLOADTOFILE()

or

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

Re: checking an url

Posted: Wed Dec 02, 2020 7:38 am
by Horizon
Thank you,

URLDOWNLOADTOFILE() function solved my problem.

Re: checking an url

Posted: Wed Dec 02, 2020 8:34 am
by nageswaragunupudi
Can you please try this simple function?

Code: Select all

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

Re: checking an url

Posted: Wed Dec 02, 2020 8:52 am
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.

Re: checking an url

Posted: Wed Dec 09, 2020 1:43 pm
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.

Re: checking an url

Posted: Wed Dec 09, 2020 3:11 pm
by nageswaragunupudi
Is there an option to show progress of download?
No.

Re: checking an url

Posted: Sat Dec 19, 2020 11:43 pm
by FWExplorer
Can this be used, to check the validity of sites with credentials?

Re: checking an url

Posted: Tue Dec 29, 2020 5:10 pm
by Antonio Linares