Jump to content

Help me with PHP SDK - problem


=DC=

Recommended Posts

Hi, today i was trying to do function which displays players who are online on my website using php_sdk and i have problem with connection to server.

HTTP port is opened, user who i'm using to connect has admin rights and it's not working.

mta_sdk version 0.4 - downloaded from wiki mta


this is php file on my website:

<?php
include( "mta_sdk.php" );

$mtaServer = new mta( "ip", 20145, "mta_php_sdk", "password" );
$resource = $mtaServer->getResource ( "php" );
$returns[] = $resource->call ( "getPlayersOnline" );
  
?>



And the error:

Fatal error: Uncaught exception 'Exception' with message 'Could not connect to ip:20145' in 
/home/users/XXX/public_html/YYY/mta_php_sdk/mta_sdk.php:146 Stack trace: #0 
/home/users/XXX/public_html/YYY/mta_php_sdk/mta_sdk.php(79): mta->do_post_request('ip', 20145, '/php/call...', '') #1
/home/users/XXX/public_html/YYY/mta_php_sdk/mta_sdk.php(257): mta->callFunction('php', 'getPlayersOnlin...', Array) #2
/home/users/XXX/public_html/YYY/mta_php_sdk/mta.php(38): Resource->call('getPlayersOnlin...') #3 {main} thrown in
/home/users/XXX/public_html/YYY/mta_php_sdk/mta_sdk.php on line 146

 

If i visit in my browser  ip:20145/php/call/getPlayersOnline   everything is working correctly.



How can i fix it?

Link to post

Yes, you're right i hid it because not everybody must know it :P There is my server ip without port ofcourse.

I found some info about this and it looks that my website hosting is blocking some functions like e.g.  fsockopen

Link to post

I was searching more and more info about SDK and mine problem is that my website hosting is blocking some ports, so I can't connect to server, but I asked them to open it and I hope that it resolve everything. When I was testing this code on WebServ everything was working fine :D

Link to post

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