Put this in a file in your forum root and name it stat_api.php
- Code: Select all
<?php
/**
* API to get some forum data to a external page.
*
* @copyright (c) 2010 phpbbmodders.net
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
* This one returns number of users, topics and posts.
*/
/**
* @ignore
*/
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
echo $config['num_users'] . '|' . $config['num_topics'] . '|' , $config['num_posts'];
?>
Then on your external site.
- Code: Select all
<?php
$str = @file_get_contents('http://phpbbmodders.net/board/stat_api.php');
$arr = explode('|', $str);
echo $arr[0] . '<br />'; // Total users.
echo $arr[1] . '<br />'; // Total topics.
echo $arr[2] . '<br />'; // Total posts.
?>
Of course you can replace the data with whatever you want to send to the external site. Don't forget to change the url to your own.
Have fun.





