PHP code example of liogi / surveymonkey-api-v3

1. Go to this page and download the library: Download liogi/surveymonkey-api-v3 library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

liogi / surveymonkey-api-v3 example snippets


$SM = new SurveyMonkey("myApiKey" , "myAccessToken");
$result = $SM->getSurveyList();
if ($result["success"]) print_r( $result["data"] );
else print_r($result["message"]);   // Print out the error message

$SM = new SurveyMonkey("myApiKey" , "myAccessToken", 
    array(  // Override default API options (quite useless at the moment)
        'protocol' => 'http',                       // will not work.. they // ...<Any CURLOPT>...
    )
);
$result = $SM->getSurveyList(array(
    "fields" => array(
        "title",
        "page",
        "start_modified_at",
        "end_modified_at",
        "sort_by"
    ),
));

/**
 * Returns a list of surveys owned or shared with the authenticated user
 * @see https://developer.surveymonkey.com/api/v3/#surveys
 * @param array $params optional request array
 * @return array Result
 */
public function getSurveyList($params = array()){}

/**
 * Retrieve a given survey's metadata.
 * @see https://developer.surveymonkey.com/api/v3/#surveys-id-collectors
 * @param string $surveyId Survey ID
 * @param array $params optional request array
 * @return array Results
 */
public function getSurveyDetails($surveyId, $params = array()){}

/**
 * Retrieves a paged list of collectors for a survey in a user's account.
 * @see https://developer.surveymonkey.com/api/v3/#collectors-id
 * @param string $surveyId Survey ID
 * @param array $params optional request array
 * @return array Results
 */
public function getCollectorList($surveyId, $params = array()){}

/**
 * Retrieves a paged list of respondents for a given survey and optionally collector
 * @see https://developer.surveymonkey.com/api/v3/#surveys-id-responses-bulk
 * @param string $surveyId Survey ID
 * @param array $params optional request array
 * @return array Results
 */
public function getRespondentList($surveyId, $params = array()){}

/**
 * Takes a list of respondent and returns the responses that correlate to them.
 * @param string $surveyId Survey ID
 * @param array $params optional request array
 * @return array Results
 */
public function getResponses($surveyId, $params = []){}

/**
* Retrieves a paged list of templates provided by survey monkey.
* @see https://developer.surveymonkey.com/api/v3/#surveys-id-collectors
* @param string $surveyId Survey ID
* @param string $collectorName optional Collector Name - defaults to 'New Link'
* @param string $collectorType 

/**
 * Create a survey, email collector and email message based on a template or existing survey.
 * @see https://developer.surveymonkey.com/api/v3/#surveys
 * @param string $surveyTitle Survey Title
 * @param string $from_survey_id Existing survey
 * @param array $params optional request array
 * @return array Results
 */
public function createFlow($surveyTitle, $from_survey_id, $params = array()){}

/**
 * Modifies a survey’s title, nickname or language.
 * @see https://developer.surveymonkey.net/api/v3/#surveys
 * @param string $surveyID Survey ID
 * @param array $params optional request array
 * @return array Results
 */
public function updateSurvey($surveyID, $params = array()){}