read variables from browser, php or xml

雨燕双飞 提交于 2019-12-12 04:32:11

问题


I have a application in autoit , I need to somehow read a result of a php code using autoit, so the php code will check de DB serverside, and if it`s OK the autoit process will continue, if not it will stop.


回答1:


Your question is vague, so I give you a simple example.

Make a file called in the webserver called "autoit-api.php". Put code in it something like this:

$result = mysql_query('SELECT * WHERE 1=1');
if (!$result) {
    die('Invalid query: ' . mysql_error());
} else {
    echo $result;
}

The idea is that you will use this file to retrieve the data from the database, and just print it. Don't add any HTML. Print just the value.

Also make an AutoIt script on your own computer and call it "retrieve php value.au3" or similar. Put in it a code like this:

#include <INet.au3>
$value = _INetGetSource ( "http://www.mywebsite.com/autoit-api.php" )
MsgBox(0, "The value is:", $value)

Then AutoIt will make a message box with the value that he got from the php script.



来源:https://stackoverflow.com/questions/7056368/read-variables-from-browser-php-or-xml

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!