Jump to content

Using PHP SDK


Guest Chudy

Recommended Posts

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

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

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