The problem is: I have a VBScript, which is run from the WinCCRuntime app (Siemens software). The script creates the MSXML2.XMLHTTP object and send data to a handler (written on PHP), which is run upon OpenServer 5.3.0.Premium (free web-server) on the same host (all the apps on a virtual machine). After script workiking I receive in VBS app readystate "4" and responsetext with correct data (PHP just prints out what it has received). But these data dont get printed out on the page in the browser!!! (Echo prints nothing, print_r prints just ampty Array). The problem is the same when using GET and POST. When just go by link localhost:90/ajax1/handler.php?value=value everything is OK. I need to send data from WInCC app to WEB app. What is the promlem may be in? I had seen through: POST array not getting printed But there's another matter. Thank in advance.
This is the VBScript:
Sub OnLButtonDown(ByVal Item, ByVal Flags, ByVal x, ByVal y)
Dim xmlhttp
Set xmlhttp = CreateObject("MSXML2.XMLHTTP")
data1="hello"
xmlhttp.open "GET", "http://localhost:90/ajax1/handler.php?value="&data1, True
xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
xmlhttp.setRequestHeader "Access-Control-Allow-Origin", " *"
xmlhttp.send ""
Dim obj4
Set obj4 = HMIRuntime.Screens("http").ScreenItems("Button2")
obj4.Text=xmlhttp.readyState
Dim obj3
Set obj3 = HMIRuntime.Screens("http").ScreenItems("Button3")
obj3.Text=xmlhttp.responseText
End Sub
This is PHP script:
<?php
$value=$_GET['value'];
echo $value."<br/>";
?>
You are making an async request. Program execution will continue and execute
obj4.Text=xmlhttp.readyState
before the ready state has reached 4 and the response processed.See the documentation: