The following script will showcase what is possible using the GetURL and PostURL commands along with the isxGames_onHTTPResponse event:
atom onHTTPResponse(int Size, string URL, string IPAddress, int ResponseCode, float TransferTime, string ResponseText, string ParsedBody)
{
variable string Status = "??" ;; TODO: Add short "text" Status for all Response Codes, if desired/needed.
if (${ResponseCode.Equal[200]})
Status:Set["OK"]
else
Status:Set[${ResponseCode}]
echo "[HTTPS-Test] onHTTPResponse(${Status})"
echo "[HTTPS-Test] - Size: ${Size}"
echo "[HTTPS-Test] - URL: ${URL}"
echo "[HTTPS-Test] - IPAddress: ${IPAddress}"
echo "[HTTPS-Test] - TransferTime: ${TransferTime}"
echo "[HTTPS-Test] - ResponseText: '${ResponseText}'"
echo "[HTTPS-Test] ---------"
}
function main()
{
;; Initialization
variable uint FrameCounter = 0
Event[isxGames_onHTTPResponse]:AttachAtom[onHTTPResponse]
;; Work
echo "[HTTPS-Test] Testing GetURL with 'https://www.isxgames.com/test/get.php?name=Amadeus&project=isxGames'"
GetURL "http://www.isxgames.com/test/get.php?name=Amadeus&project=isxGames"
echo "[HTTPS-Test] Testing PostURL with 'https://www.isxgames.com/test/post.php' 'name=Amadeus&project=isxGames' "
PostURL "http://www.isxgames.com/test/post.php" "name=Amadeus&project=isxGames"
;; Finished
do
{
waitframe
;echo ${FrameCounter}
}
while ((${FrameCounter:Inc} < 80) && (${ISXEVE(exists)} || ${ISXEQ2(exists)}))
}
function atexit()
{
Event[isxGames_onHTTPResponse]:DetachAtom[onHTTPResponse]
echo "[HTTPS-Test] Script Ended\n\r\n\r"
return
}
{
variable string Status = "??" ;; TODO: Add short "text" Status for all Response Codes, if desired/needed.
if (${ResponseCode.Equal[200]})
Status:Set["OK"]
else
Status:Set[${ResponseCode}]
echo "[HTTPS-Test] onHTTPResponse(${Status})"
echo "[HTTPS-Test] - Size: ${Size}"
echo "[HTTPS-Test] - URL: ${URL}"
echo "[HTTPS-Test] - IPAddress: ${IPAddress}"
echo "[HTTPS-Test] - TransferTime: ${TransferTime}"
echo "[HTTPS-Test] - ResponseText: '${ResponseText}'"
echo "[HTTPS-Test] ---------"
}
function main()
{
;; Initialization
variable uint FrameCounter = 0
Event[isxGames_onHTTPResponse]:AttachAtom[onHTTPResponse]
;; Work
echo "[HTTPS-Test] Testing GetURL with 'https://www.isxgames.com/test/get.php?name=Amadeus&project=isxGames'"
GetURL "http://www.isxgames.com/test/get.php?name=Amadeus&project=isxGames"
echo "[HTTPS-Test] Testing PostURL with 'https://www.isxgames.com/test/post.php' 'name=Amadeus&project=isxGames' "
PostURL "http://www.isxgames.com/test/post.php" "name=Amadeus&project=isxGames"
;; Finished
do
{
waitframe
;echo ${FrameCounter}
}
while ((${FrameCounter:Inc} < 80) && (${ISXEVE(exists)} || ${ISXEQ2(exists)}))
}
function atexit()
{
Event[isxGames_onHTTPResponse]:DetachAtom[onHTTPResponse]
echo "[HTTPS-Test] Script Ended\n\r\n\r"
return
}
Running this script will output to the console something similar to:
[HTTPS-Test] Testing GetURL with 'https://www.isxgames.com/test/get.php?name=Amadeus&project=isxGames
[HTTPS-Test] Testing PostURL with 'https://www.isxgames.com/test/post.php' 'name=Amadeus&project=isxGames'
[HTTPS-Test] onHTTPResponse(OK)
[HTTPS-Test] - Size: 76
[HTTPS-Test] - URL: http://www.isxgames.com/test/get.php?name=Amadeus&project=isxGames
[HTTPS-Test] - IPAddress: 99.99.99.99
[HTTPS-Test] - TransferTime: 0.070000
[HTTPS-Test] - ResponseText: 'GET data received as follows: name = Amadeus || project = isxGames'
[HTTPS-Test] ---------
[HTTPS-Test] onHTTPResponse(OK)
[HTTPS-Test] - Size: 77
[HTTPS-Test] - URL: http://www.isxgames.com/test/post.php
[HTTPS-Test] - IPAddress: 99.99.99.99
[HTTPS-Test] - TransferTime: 0.210000
[HTTPS-Test] - ResponseText: 'POST data received as follows: name = Amadeus || project = isxGames'
[HTTPS-Test] ---------
[HTTPS-Test] Script Ended
[HTTPS-Test] Testing PostURL with 'https://www.isxgames.com/test/post.php' 'name=Amadeus&project=isxGames'
[HTTPS-Test] onHTTPResponse(OK)
[HTTPS-Test] - Size: 76
[HTTPS-Test] - URL: http://www.isxgames.com/test/get.php?name=Amadeus&project=isxGames
[HTTPS-Test] - IPAddress: 99.99.99.99
[HTTPS-Test] - TransferTime: 0.070000
[HTTPS-Test] - ResponseText: 'GET data received as follows: name = Amadeus || project = isxGames'
[HTTPS-Test] ---------
[HTTPS-Test] onHTTPResponse(OK)
[HTTPS-Test] - Size: 77
[HTTPS-Test] - URL: http://www.isxgames.com/test/post.php
[HTTPS-Test] - IPAddress: 99.99.99.99
[HTTPS-Test] - TransferTime: 0.210000
[HTTPS-Test] - ResponseText: 'POST data received as follows: name = Amadeus || project = isxGames'
[HTTPS-Test] ---------
[HTTPS-Test] Script Ended