I am getting started with LiveCode and will write a wee test app to check my server status. Basically I wanna analyse the http header to see if it is 200 or something different. However, when testing the script runs fine with vServer19 and vServer22, but when I put vServer10 into the ShellCode generated, it does not work, the variable does not get a value assigned..
Can u help me?
(had to exchange the URLs with URL1-3 since this forum doesn't allow me to post links. but even when using the same URL in vServer10 and vServer19 it did not behave the same way)
Stack Script:
Code: Select all
on preOpenStack
# Define Variables
global vServer10
global vServer19
global vServer22
put "URL1" into vServer10 # Server 10
put "URL2" into vServer22 # Server 22
put "URL3" into vServer19 # Server 19
end preOpenStack
Code: Select all
on mouseUp
# get globals from stack
global vServer10
global vServer19
global vServer22
# Create Shell Command
# Create ShellCode to execute
# Change server here manually for now
put "curl -sL -w '%{http_code}' " & vServer10 & " -o /dev/null" into tShellCode
#execute shell code and put into result variable
answer tShellCode
put shell (tShellCode) into tResultHeader
answer tResultHeader
#evaluate result header
if tResultHeader is "200" then
answer "All fine. Header code " & tResultHeader
else
answer "Error: " & tResultHeader & ". Please correct"
end if
end mouseUp
Pascal