Exemple #1
0
if (!isset($_REQUEST['userid'])) {
    return json_encode(array('status' => 'invalidargs'));
}
// include fakememcache here, as a convenience
require_once dirname(__FILE__) . '/fakememcache.php';
// If XML_Serializer is not already in the include_path, dynamically add the
// folder that is bundled with this sample that includes a copy of XML_Serializer
// (along with its own dependencies).
if (!in_include_path('XML/Serializer.php')) {
    set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__) . DIRECTORY_SEPARATOR . 'pear');
}
// initialize split here, since all services will include this code
require_once dirname(__FILE__) . '/Splyt/Splyt.php';
// We must always initialize Splyt before use with either a user id, a device id, or both.  In
// the case of BubblePop, we use only a user id
$splyt = Splyt::init('rsb-bubblepopphp-test', $_REQUEST['userid']);
/**
 * Determines whether a file is found in the PHP include path.
 *
 * @param $file The file to find.
 *
 * Newer PHP versions could use stream_resolve_include_path(); this function
 * is provided in case we're running on an older version.
 */
function in_include_path($file)
{
    $paths = explode(PATH_SEPARATOR, get_include_path());
    $found = false;
    foreach ($paths as $p) {
        $fullname = $p . DIRECTORY_SEPARATOR . $file;
        if (is_file($fullname)) {
Exemple #2
0
<?php

// The purpose of this script is to drive the interface for interface testing.
// It is light weight and doesn't require special SDKs or libs to be installed,
// just a php interpreter and a SPLYT data collector to point it at.
define('SSF_SERVER', 'http://localhost');
require_once '../include/Splyt.php';
require_once '../include/Splyt_Custom.php';
// ### INIT ###
$splyt = Splyt::init('rsb-dataexample-test', 'user', 'device');
// ### BEGIN TXN ###
// Lots of defaults
$splyt->Custom->beginTransaction('begin');
// Timeout combinations
$splyt->Custom->beginTransaction('begin', $timeoutMode = Splyt::TIMEOUT_MODE_TRANSACTION);
$splyt->Custom->beginTransaction('begin', null, 30);
$splyt->Custom->beginTransaction('begin', $timeoutMode = Splyt::TIMEOUT_MODE_TRANSACTION, 30);
$splyt->Custom->beginTransaction('begin', $timeoutMode = Splyt::TIMEOUT_MODE_ANY, 30);
// Full
$splyt->Custom->beginTransaction('begin', $timeoutMode = Splyt::TIMEOUT_MODE_ANY, 30, array('property' => 5), 'mytxnid');
// ### UPDATE TXN ###
$splyt->Custom->updateTransaction('update', 50, array('property' => 6));
$splyt->Custom->updateTransaction('update', 50, null, 'mytxnid');
$splyt->Custom->updateTransaction('update', 50, array('property' => 6), 'mytxnid');
// ### END TXN ###
$splyt->Custom->endTransaction('end');
$splyt->Custom->endTransaction('end', Splyt::TXN_ERROR);
$splyt->Custom->endTransaction('end', null, array('property' => 7));
$splyt->Custom->endTransaction('end', null, null, 'mytxnid');
$splyt->Custom->endTransaction('end', Splyt::TXN_ERROR, array('property' => 7), 'mytxnid');
// ### UPDATE USER STATE ###