Jump to content

[SOLVED] PHP SDK


Dev

Recommended Posts

Hey,

So, I've been trying to make this example work on the wiki page for PHP SDK, I have Apache 2.2 and PHP 5.3 installed and successfully running on my PC, I also have the PHP SDK files in my htdocs folder of Apache along with this new call.php file I just created, but for some reason it is only returning 'nil'.

If someone has any idea or past experiences with SDK, please help me out.

  
-- call.lua 
function result(sum) 
    if sum ~= "ERROR" then 
        outputDebugString(tostring(sum)) 
    end 
end 
  
function phpCall( ) 
    callRemote ( "localhost:80/call.php", result, 12, 16 ) 
end 
addCommandHandler("call", phpCall) 
  

  
// call.php 
<html> 
    <body> 
        <?php 
            include( "mta_sdk.php" ); 
            $input = mta::getInput(); 
            mta::doReturn($input[0] + $input[1]); 
        ?> 
    </body> 
</html> 
  

Edited by Guest
Link to comment
  • Scripting Moderators

I tested, it works.

e8b9755a308e9209d7824eb6a8c65182.png

maybe, try this:

<?php 
    include( "mta_sdk.php" ); 
    $input = mta::getInput(); 
    mta::doReturn($input[0] + $input[1]); 
?> 

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...