PHP code example of buuum / typeform

1. Go to this page and download the library: Download buuum/typeform 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/ */

    

buuum / typeform example snippets


$typeform = new Typeform($api_key);
$response = $typeform->getForm($token_form);

array(3) {
  ["stats"]=> array(3) {
    ["showing"]=> int(1)
    ["total"]=> int(48)
    ["completed"]=> int(27)
  }
  ["questions"]=> array(9) {
    [0]=> array(3) {
      ["id"]=>
      string(20) "list_24762704_choice"
      ["question"]=>
      string(4) "test"
      ["field_id"]=>
      int(24762704)
    }
    ... 
  }
  ["responses"]=>
    array(5) {
      ["completed"]=>
      string(1) "1"
      ["token"]=>
      string(32) "bdc6d79bbf141af6b119f7bffde31bcb"
      ["metadata"]=>
      array(7) {
        ["browser"]=>
        string(7) "default"
        ["platform"]=>
        string(5) "other"
        ["date_land"]=>
        string(19) "2016-11-30 16:30:28"
        ["date_submit"]=>
        string(19) "2016-11-30 16:30:38"
        ["user_agent"]=>
        string(120) "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.98 Safari/537.36"
        ["referer"]=>
        string(59) "https://kuvut1.typeform.com/to/A7moU3?hash=dsfsdf&quiz=3243"
        ["network_id"]=>
        string(10) "11ab630aa4"
      }
      ["hidden"]=>
      array(2) {
        ["hash"]=>
        string(6) "dsfsdf"
        ["quiz"]=>
        string(4) "3243"
      }
      ["answers"]=>
      array(6) {
        ["list_24762704_choice"]=>
        string(1) "1"
        ["yesno_24736784"]=>
        string(1) "0"
        ["list_24817134_choice"]=>
        string(2) "r2"
        ["list_24817136_choice"]=>
        string(2) "r2"
        ["number_24818069"]=>
        string(3) "423"
        ["score"]=>
        string(1) "3"
      }
    }
    

$typeform = new Typeform($api_key, $url_typeform);
$typeform->getForms();

$typeform->getStats();
$typeform->getQuestions();
$typeform->getResponses();

$typeform = new Typeform($api_key, $url_typeform);
$typeform->getAllForms();

$typeform->getStats();
$typeform->getQuestions();
$typeform->getResponses();

$typeform = new Typeform($api_key, $url_typeform);
$typeform->getAllForms();

$data = $typeform->formatDataByExport();

$fp = fopen('excel.csv', 'w');
fputcsv($fp, $data['headers'], "\t");
foreach ($data['rows'] as $row) {
    fputcsv($fp, $row, "\t");
}
fclose($fp);


$typeform->getNextPage();
$typeform->getPrevPage();


$typeform->setLimit(10);
$typeform->setApiKey($api_key);
$typeform->setApiUri($api_uri);
$typeform->setFormId($formId);
$typeform->setFormIdFromUrl($url_typeform);
$typeform->setPage($page);
$typeform->setCompleted($completed);
$typeform->setSince($since);
$typeform->setUntil($until);



try{
    $typeform = new Typeform($api_key);
    $response = $typeform->getPayLoad();
 }catch(Exception $e){
    echo $e->getMessage();
}


array(
    'hiddens' => array(
        'hash' => ''
     ),
    'score'   => 43,
    'token'   => '4234324234332ewfwer3r2rfe'
);