问题
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