API Usage in Skins

mikeyg6754

Verified User
Joined
Jan 23, 2012
Messages
20
Hello,
I would like to be able to retrieve Server Stats in a skin that I am working on. It seems that all the stats that I am looking to use individually are contained within the |STATS| variable.
I saw the CMD_ADMIN_STATS in the API and it looks like this would be perfect. I am just unsure of how I should go about retrieving the variables from the Skin.

Thanks in advance for the help!
 
If I were to use CMD_ADMIN_STATS how would I get the results to the page, would I have to use CURL ?
 
Ok, I've looked at this class and it looks like it might work. My only problem now is:

$sock->connect('yoursite.com',2222);
$sock->set_login('admin','password');

How can I get the current login data in order to connect?
 
If I'm not mistaken, you can connect to 127.0.0.1

PHP:
$sock->connect('127.0.0.1',2222);

within the current session without need to authenticate additionally.
 
When I put the following in my content_main.html it ends up printing part of the code on screen.
Maybe I'm doing something wrong. I've tried to change the file extensions of index and content_main to php and update them in the files_admin.conf but that did not change anything.
PHP:
<?php
	include '|HTM_SOCKET|';

	$sock = new HTTPSocket;

	$sock->connect('127.0.0.1',2222);

	$sock->query('/CMD_API_SHOW_ALL_USERS');
	$result = $sock->fetch_parsed_body();

?>

Here is exactly what I am getting.

DA_PHPskin.png


I appreciate your help!
 
Back
Top