Hello! Such a problem: There is a script on VBS, which is launched from the WinCCRuntime application (such software from Siemens). The script creates an MSXML2.XMLHTTP object and sends the data to a handler written in PHP, which runs under OpenServer 5.3.0.Premium on the same host (all this on a virtual machine). After executing the script, readystate "4" is returned to the application and the responsetext with the corresponding data (PHP simply prints what was sent to it). But on the page in the browser, these data are not displayed !!! (Echo doesn't print anything at all, print_r displays an empty Array). The problem is the same when using GET and POST. I need to display the data in a web application. What could be the problem? I watched the question. The browser does not display the data sent by the POST method, but there was another web server. I just have an openserver. Thank you in advance. This is the VBS code:

Sub OnLButtonDown(ByVal Item, ByVal Flags, ByVal x, ByVal y) Dim data2 data2=HMIRuntime.Tags("Plant1/RMT1/LI111/CFC_LI111/LIA.#comment").Read 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 the PHP code:

 <?php $value=$_GET['value']; echo $value."<br/>"; ?> 

4 is readystate, hello <br/> is responsetext

  • and if without scripts, VBS and applications, just follow the link localhost: 90 / ajax1 / handler.php? value = value then displays something? If not, then remove all unnecessary information from the question, and ask it on the support form OpenServer 5.3.0.Premium. If it does, then remove all the superfluous from the question, and ask where they ask questions about VBS - Ipatyev
  • Yes, it's just that everything is displayed by reference. But if the problem is inside a VB script, then how then the correct response from the browser is returned to the application? - Victoria
  • I cannot understand one thing in this confused explanation: what does Echo and print_r have to do with it? At what point do they vyplnyatsya? Why are they even mentioned here if it is written before this that "After the script is executed, readystate" 4 "is returned to the application and the responsetext with the corresponding data (PHP simply prints what was sent to it)."? PHP has already output the data. Where are the extra echo and print_r here? In which browser should they display something? What data? from where - Ipatiev
  • I open the file handler.php with chrome. If you just send data in the address bar, they are displayed on the page. If the request comes from a third-party application, the response is returned to the application, and the data is not displayed on the page. - Victoria
  • Why should the data be displayed on the page if the application requested them not the page? - Ipatiev

1 answer 1

 DataToSend = "value="&data1 xmlhttp.send DataToSend 
  • Sergey, send data is sent if POST is used, and in GET it must be in Open. But anyway, PHP does not display them in the browser, although they fall into $ _GET - Victoria
  • and if POST send? - Sergey Konovalov
  • and xmlhttp.setRequestHeader "Access-Control-Allow-Origin", "*" - why is the space before * - Sergey Konovalov
  • POST the same result, spaces here also do not affect anything - Victoria