Hi,
I wrote a python utility earlier in the year that checks connectivity, and optionally html file size, and optionally with credentials.
Are there some FW snippets that will accomplish the same thing? I already tried searching through Minigui and played with TIpClientHttp, and cannot find anything in the fwh distribution.
Some of the sites I'm checking are https ; some are http.
How to check the status of a url, with credentials
-
- Posts: 83
- Joined: Fri Aug 09, 2013 12:43 am
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: How to check the status of a url, with credentials
This works without credentials:
function WebPageContents( cUrl, lText ) --> cContents
For credentials we have to use:
user = "someusername"
password = "somepassword"
xmlhttp.setRequestHeader "Authorization", "Basic " + Base64Encode(user + ":" + password)
function WebPageContents( cUrl, lText ) --> cContents
For credentials we have to use:
user = "someusername"
password = "somepassword"
xmlhttp.setRequestHeader "Authorization", "Basic " + Base64Encode(user + ":" + password)
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: How to check the status of a url, with credentials
Here you have a working example with credentials:
http://forums.fivetechsupport.com/viewt ... 92#p234092
http://forums.fivetechsupport.com/viewt ... 92#p234092
-
- Posts: 83
- Joined: Fri Aug 09, 2013 12:43 am
Re: How to check the status of a url, with credentials
Thanks, Antonio.
Antonio Linares wrote:This works without credentials:
function WebPageContents( cUrl, lText ) --> cContents
For credentials we have to use:
user = "someusername"
password = "somepassword"
xmlhttp.setRequestHeader "Authorization", "Basic " + Base64Encode(user + ":" + password)
-
- Posts: 83
- Joined: Fri Aug 09, 2013 12:43 am
Re: How to check the status of a url, with credentials
What option do we need, on the Buildh command line to include the FW Ole functions?
I put PingValidate.prg, containing WebPageContents() in the samples folder. But we have some missing externals.
Which library has olefuncs.prg already linked in?
Error: Unresolved external '_HB_FUN_FWGETOLEOBJECT' referenced from C:\FWH\SAMPLES\PINGVALIDATE.OBJ
Error: Unresolved external '_HB_FUN_FW_GT' referenced from C:\FWH\SAMPLES\PINGVALIDATE.OBJ
Error: Unable to perform link
* Linking errors *
I put PingValidate.prg, containing WebPageContents() in the samples folder. But we have some missing externals.
Which library has olefuncs.prg already linked in?
Error: Unresolved external '_HB_FUN_FWGETOLEOBJECT' referenced from C:\FWH\SAMPLES\PINGVALIDATE.OBJ
Error: Unresolved external '_HB_FUN_FW_GT' referenced from C:\FWH\SAMPLES\PINGVALIDATE.OBJ
Error: Unable to perform link
* Linking errors *
Code: Select all
#include "fivewin.ch"
function WebPageContents( cUrl, lText )
local oHttp, cContents := ""
local nOle := 0
local aOle := { "MSXML2.XMLHTTP", "WINHTTP.WinHttpRequest.5.1" }
if Lower( Left( cUrl, 7 ) ) == "http://" .or. Lower( Left( cUrl, 8 ) ) == "https://"
do while Empty( cContents ) .and. nOle < 2
nOle++
TRY
oHttp := FWGetOleObject( aOle[ nOle ] )
oHttp:Open("GET", cUrl, .f. )
oHttp:Send()
DEFAULT lText := .f.
if lText
cContents := oHttp:ResponseText()
else
cContents := oHttp:ResponseBody()
endif
CATCH
END
enddo
endif
return cContents
//----------------------------------------------------------------------------//
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: How to check the status of a url, with credentials
D.
> Which library has olefuncs.prg already linked in?
FiveH.lib
> Which library has olefuncs.prg already linked in?
FiveH.lib
-
- Posts: 83
- Joined: Fri Aug 09, 2013 12:43 am
Re: How to check the status of a url, with credentials
Never mind. I typed build.bat, rather than buildh.bat. Everything's good.