Note: This is a fork of the SMF REST API by Andre Nickatina. Our intention is to upgrade and maintain the API.
Use this to integrate your SMF version 2.0 forum with 3rd party software If you need help using this script or integrating your forum with other software, feel free to contact [email protected]
- @package SMF 2.0 'REST' API
- @author Simple Machines http://www.simplemachines.org
- @author Andre Nickatina [email protected]
- @copyright 2011 Simple Machines
- @link http://www.simplemachines.org Simple Machines
- @link http://www.r2bconcepts.com Red2Black Concepts
- @license http://www.simplemachines.org/about/smf/license.php BSD
- @version 0.1.2
Installation using composer
Add the following to your composer.json
file:
"require":
{
"erazorbg/smfapi": "dev-master"
},
"repositories":
[
{
"type": "vcs",
"url" : "https://github.com/erazorbg/smfapi.git"
}
]
Update dependencies:
php composer update
- Upload the content of the Server folder to your SMF installation folder
- (optional) Change the path to your
Settings.php
//path/to/your/smf/api/folder/smf_2_api.php
// manually add the location of your Settings.php here
if (!isset($settings_path) || empty($settings_path)) {
// specify the settings path here if it's not in smf root and you want to speed things up
// $settings_path = $_SERVER['DOCUMENT_ROOT'] . /path/to/Settings.php
if (isset($settings_path) && !file_exists($settings_path)) {
unset($settings_path);
}
}
- (optional) In case you use nginx as webserver configure it to emulate the
.htaccess
Satisfy Any
RewriteEngine on
RewriteRule .* index.php [L]
- Set an API key in the
index.php
file:
define ('SECRET_KEY', 'Put your secret key here'); // set your secret key here
Hint: You may generate a key under Linux with a bash command like:
dd if=/dev/urandom bs=8 count=8 | openssl base64 | tr -d '\n'
<?php
$client = new SmfApi\Client\SmfRestClient($apiServerUrl, $secretKey);