Guest Posted June 6, 2008 Share Posted June 6, 2008 I tried to use PHP SDK and just call a simple function that prints something in console. My PHP code looks like this: <? include( "mta_sdk.php" ); $mtaServer = new mta("ip", 22005, "test", "test"); //i wasn;t sure with this but i added to accounts.xml and acl.xml user 'test' $resource = $mtaServer->getResource ( "lh" ); // the resource i'm using $returns[] = $resource->call ( "smth" );// the lua function ?> But it does not work, it shows up this: Fatal error: Uncaught exception 'Exception' with message 'Not Found' in /var/www/web1/html/mta_sdk.php:203 Stack trace: #0 /var/www/web1/html/mta_sdk.php(79): mta->do_post_request('my_ip', 22005, '/lh/call/smth', '') #1 /var/www/web1/html/mta_sdk.php(257): mta->callFunction('lh', 'smth', Array) #2 /var/www/web1/html/index123.php(: Resource->call('smth') #3 {main} thrown in /var/www/web1/html/mta_sdk.php on line 203 @edit I think the problem is with the username, there is something about http username and password in mta_sdk.php but how can i make that username? By the way, I don't know if this has to do with it, but only resource I am running is the one i made and 'scoreboard' Also, is there any way to disable the http authentication? Link to comment
eAi Posted June 7, 2008 Share Posted June 7, 2008 Is 22005 your server's http port? Thats the port you should be specifying... Link to comment
Guest Posted June 7, 2008 Share Posted June 7, 2008 Ofcourse it is, because when I use another port in my PHP script it says ' Uncaught exception 'Exception' with message 'Could not connect to IP:PORT' Link to comment
50p Posted June 8, 2008 Share Posted June 8, 2008 Also, is there any way to disable the http authentication? The best way to do this is to give Default acl access to HTTP. In acl.xml: <right name="general.http" access="true" /> Link to comment
eAi Posted June 8, 2008 Share Posted June 8, 2008 If you visit http://my_ip:22005/lh/call/smth (in your browser, replacing my_ip with your IP, obviously) what happens? Link to comment
50p Posted June 9, 2008 Share Posted June 9, 2008 'Not found' means the function you are trying to call does not exist, right? So you have to export it first. In meta.xml: <export function="functionName" http="true" /> Link to comment
eAi Posted June 9, 2008 Share Posted June 9, 2008 If you need any help with the PHP SDK or anything relating to the web interface, come and bug me on IRC. Link to comment
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