The top examples apply to MindTouch version prior to Lyons. See the last sample for Lyons.
$dreamServer = 'http://YOURWIKI:DREAMPORT';
$dreamServer = 'http://YOURWIKI/@api';
$dekiApi = 'deki';
// end plug configuration
$username = 'admin';
$password = 'password'; // i hope your password isn't password
// end user config
$Plug = new Plug($dreamServer);
$Plug = $Plug->At($dekiApi);
$authResult = $Plug->At('users', 'authenticate')->WithCredentials($username, $password)->Get();
$authToken = $authResult['body'];
$Plug = $Plug->With('authtoken', $authToken);
// now subsequent requests will be accessed with the authenticated user's persmissions
$result = $Plug->At('something', 'something')->Get();
// using the authenticated plug object from Example 1
$path = 'Some/Page I/Want to/GetDetails';
$result = $Plug->At('pages', urlencode(urlencode($path)))->Get();
print_r($result);
Assuming you have enabled trusted auth... http://wiki.developer.mindtouch.com/...t=trusted+auth
$dreamServer = 'http://YOURWIKI:DREAMPORT';
$dreamServer = 'http://YOURWIKI/@api';
$dekiApiKey = 'asdfasdf';
$dekiApi = 'deki';
// end plug configuration
$username = 'admin';
$password = 'password'; // i hope your password isn't password
// end user config
$Plug = new Plug($dreamServer);
$Plug = $Plug->At($dekiApi);
// if password is not specified the user is unable to login to deki directly
// $password = null;
$authResult = $Plug->At('users', 'authenticate')->With('apikey', $dekiApiKey)->WithCredentials($username, $password)->Get();
$authToken = $authResult['body'];
// now that you have the deki auth token, set the cookie for the domain
setcookie('authtoken', $authToken ... ); // you get the idea
// change these include paths based on your installation
include('deki/core/dream_plug.php');
// pick the dreamserver that matches your installation
$dreamServer = 'http://YOURWIKI:DREAMPORT';
$dreamServer = 'http://YOURWIKI/@api';
$dekiApi = 'deki';
// end plug configuration
$username = 'admin';
$password = 'password'; // i hope your password isn't password
// end user config
$Plug = new DreamPlug($dreamServer);
$Plug = $Plug->At($dekiApi);
$authResult = $Plug->At('users', 'authenticate')->WithCredentials($username, $password)->Get();
$authToken = $authResult['body'];
$Plug = $Plug->With('authtoken', $authToken);
// now subsequent requests will be accessed with the authenticated user's persmissions
$result = $Plug->At('something', 'something')->Get();