CloudCherry is now part of Cisco.
Learn More About Cisco

PHP

Hello World using PHP

Install Webex Experience Management PHP Library using PHP Composer

/* Install PHP Webex Experience Management API Client using Composer(getcomposer.com)
 * Step-1: curl -sS https://getcomposer.org/installer | php
 * Step-2: php composer.phar require cloudcherry/apiclient
 * Step-3: Fill in your username & password, then uncomment sections below for demo
 */
require __DIR__ . '/vendor/autoload.php';

//Start a new client using cloudcherry account
$client = new \Webex Experience Management\Client("your-username","your-password"); // Plug-in your credentials here

//Get Settings and Retrive Locations(if any)
//$settings = $client->getSettings();
//echo "Locations Found : ";
//print_r($settings->locations);

//Create Query Filter
$filter = new \Webex Experience Management\Filter();
$date = new DateTime();
$filter->afterdate =  date(DATE_ISO8601, strtotime('-30 days')); // Last 30 days

//Get Analytics
//$analytics = $client->getAnalyticsByLocation($filter);
//print_r($analytics);

//Get Underlying Responses
//$rawresponses = $client->getAnswers($filter);
//echo count($rawresponses) . "Responses Found ";
//print_r($rawresponses);

//Get Questionnaire Presented
//$questions = $client->getQuestions();
//print_r($questions);

//Add Context by adding Question Tags to each Response
//$contextresponses = $client->getAnswersWithTag($filter);
//print_r($contextresponses);

//Add Context by adding Custom Tags to each Response
//$contextresponses = $client->getAnswersWithTag($filter);
//$customLocationTagLookup = array( "NPS" => "NPSTag1", "Choice2" => "Tag2"); // Build Lookup Array using CSV/JSON
//$customChoiceTagLookup = array( "BLR" => "Bangalore", "SIN" => "Singapore"); // Build Lookup Array using CSV/JSON
//foreach($contextresponses as $answer)
//{
//    if(!empty($answer->locationId && array_key_exists($answer->locationId, $customLocationTagLookup)))
//    { //Add Custom Location Tag
//        $answer->locationTag = $customLocationTagLookup[$answer->locationId];
//    }
//    foreach($answer->responses as $response)
//    { // Add Custom Anwser Choice Tag
//        if(!empty($response->textInput) && array_key_exists($response->textInput,$customChoiceTagLookup))
//            $response->customTag = $customChoiceTagLookup[$response->textInput];
//    }
//}
//print_r($contextresponses);


/* Still got a question or need a sample snippet ready to use ?
 * Checkout API White paper at getcloudcherry.com/api
 * or Ask for Help at support -at- getcloudcherry.com
 */

?>