Smart. Posted August 1, 2012 Posted August 1, 2012 Okay, so.. the .php only outputs: "Data:" when it's supposed to show "Data: lol" .lua function daFunction(thePlayer) setElementData(thePlayer, "data", "lol") data = getElementData(thePlayer, "data") callRemote("http://mywebsite.com/mta//information.php", function() end, data) outputChatBox(data) -- it does output "lol" here. end addCommandHandler("data", daFunction) .php <?php include( "mta_sdk.php" ); $table = mta::getInput(); $data = $table[1]; echo "Data: $data<br />"; ?>
LoveFist Posted August 1, 2012 Posted August 1, 2012 In php arrays indexes starts from 0 $data = $table[0];
Smart. Posted August 1, 2012 Author Posted August 1, 2012 In php arrays indexes starts from 0 $data = $table[0]; but, <?php include( "mta_sdk.php" ); $table = mta::getInput(); $data = $table[0]; echo "Data: $data "; mta::doReturn(true); ?> outputs: Data: [true]
Cadu12 Posted August 1, 2012 Posted August 1, 2012 function daFunction(thePlayer) setElementData(thePlayer, "data", "lol") data = getElementData(thePlayer, "data") callRemote("http://mywebsite.com/mta//information.php", function(arg1) outputChatBox(arg1) end, data) end addCommandHandler("data", daFunction)
Smart. Posted August 1, 2012 Author Posted August 1, 2012 Outputs "nil" in the chatbox and same result in the .php
_Dark_ Posted August 1, 2012 Posted August 1, 2012 <?php include( "mta_sdk.php" ); $table = mta::getInput(); print_r($table); And post result.
LoveFist Posted August 1, 2012 Posted August 1, 2012 Try mta::doReturn($data); You cant check result via web browser. Because you php script deals only with mta server. If you open it in you browser result always be empty, so echo is useless.
Smart. Posted August 1, 2012 Author Posted August 1, 2012 <?php include( "mta_sdk.php" ); $table = mta::getInput(); print_r($table); And post result. blank page. Try mta::doReturn($data); You cant check result via web browser. Because you php script deals only with mta server. If you open it in you browser result always be empty, so echo is useless. result: Data: [null]
LoveFist Posted August 1, 2012 Posted August 1, 2012 Ok so this code is tested and works fine for me: function daFunction(thePlayer) setElementData(thePlayer, "data", "lol") data = getElementData(thePlayer, "data") callRemote("http://127.0.0.1/agtac/index.php", function(arg1) print(arg1) end, data) outputChatBox(data) -- it does output "lol" here. end addCommandHandler("data", daFunction) <?php include( "mta_sdk.php" ); $table = mta::getInput(); file_put_contents('test.txt',$table[0]); mta::doReturn($table[0]); ?> Result is printed to server console and to the file test.txt in website directory. Check your script url in callRemote and check resource permissions in acl.xml PS: Found a strange bug - callRemote in onResourceStart returns true but query does not reach the php script
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now