SA-MP Forums Archive
Querying SAMP Server form PHP. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP (https://sampforum.blast.hk/forumdisplay.php?fid=3)
+--- Forum: General (https://sampforum.blast.hk/forumdisplay.php?fid=13)
+--- Thread: Querying SAMP Server form PHP. (/showthread.php?tid=563247)



Querying SAMP Server form PHP. - Ahmad45123 - 14.02.2015

Is there any way I can get the server's info from PHP.

I have tried some old one's and all of them aren't working...
If there is any new one... Please reply with a link.. Will be greatly appreciated.


Re: Querying SAMP Server form PHP. - Sergei - 14.02.2015

The easiest way is to get data from SACNR monitor via their API.


Re: Querying SAMP Server form PHP. - Ahmad45123 - 14.02.2015

Quote:
Originally Posted by Sergei
Посмотреть сообщение
The easiest way is to get data from SACNR monitor via their API.
I never knew they have an API..
Thanks alot mate.

Gonna look for it.

EDIT:
Umm... Their site seems to be down for me.. ?
If you can get me a link, It'd be great


Re: Querying SAMP Server form PHP. - Vince - 14.02.2015

Or you can look here: https://sampwiki.blast.hk/wiki/Query_Mechanism
Cuts out the middle man.


Re: Querying SAMP Server form PHP. - Abagail - 14.02.2015

Honestly;
https://sampforum.blast.hk/showthread.php?tid=104299
works fine.

I don't get the issue. Additionally as already mentioned many websites offer monitor API's.


Re: Querying SAMP Server form PHP. - Ahmad45123 - 14.02.2015

Quote:
Originally Posted by Abagail
Посмотреть сообщение
Honestly;
https://sampforum.blast.hk/showthread.php?tid=104299
works fine.

I don't get the issue. Additionally as already mentioned many websites offer monitor API's.
That one keeps saying offline.


Re: Querying SAMP Server form PHP. - ev0lution - 15.02.2015

As other's have said, use Westie's SampQueryAPI for instant, up-to-date information.

Quote:
Originally Posted by Sergei
Посмотреть сообщение
The easiest way is to get data from SACNR monitor via their API.
I don't know why you would use an external service that caches results when you can quite easily query your server by yourself.


Re: Querying SAMP Server form PHP. - Blacklite - 16.02.2015

Quote:
Originally Posted by ev0lution
Посмотреть сообщение
As other's have said, use Westie's SampQueryAPI for instant, up-to-date information.

I don't know why you would use an external service that caches results when you can quite easily query your server by yourself.
Well, SACNR Monitor API tells you a few extra things:

- The server's hosted tab status
- Average players + server rank
- Previous player count readings (up to 2 weeks), suitable for using in a graph

The API will also work if your server is down temporarily (e.g. for a server restart or outage). Although SACNR Monitor has its outages from time to time as well.

If you just want to get the player count and don't care about any of this, then just use Westie's query class.