Jump to content

MTA <-> PHP - Not working


Callum

Recommended Posts

Hey,

We're trying to setup a dashboard for our server, using both MySQL and MTA. It is being written in PHP, and the MySQL part is all running fine. There is, however, a problem with hooking into the MTA server using the PHP SDK (latest version).

Here is how we are hooking into MTA; http://pastebin.com/yVN5aS6Z

The account has administrative rights, and the function is exported to http via meta.xml

I have checked the lua script, and it is returning the correct details. However, when I try and echo the returned data on the PHP page, absolutely nothing is output. I've tried everything; $info, $info[0], $info[0][0], $info[0]["name"], foreach looping, everything. The server is using PHP 5.3.2

Are there any other obvious things I've forgotton, which may be causing this problem?

Thanks,

Callum

Link to comment

1) Is display_errors enabled?

2) I use this one and it works:

$mta = new mta( "127.0.0.1", 22005, "snip", "snip" ); 
$resource = $mta->getResource ( "internet" ); 
$returns = $resource->call ( "serverInfo" ); 
$returns = $returns[0]; 

Try debugging your LUA side. PHP seems to be ok

Link to comment
Jaysds1, stop spamming. I bet that you don't know PHP.

Orange, I'm still learning php, so don't judge me

Oh, your advices made me facepalm.

I've added a debug output on the getInfo lua function. It outputs, so MTA is supplying the information, the problem must be web-related.

Maybe try to analyse mta_sdk.php sourcecode and perform the query by yourself? (afair it was http://host:port/call/resource/function)

Link to comment

I've found the problem;

The PHP file (framework.php) connects to MTA, and all the other pages (index.php, etc) include framework.php and call the function echoBoxes(). Because it connected to MTA in the root of framework.php, the variables don't exist in the function.

Quite a complex problem, but is there any solution or work around?

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...