PHP code example of adrii / zendesk-api
1. Go to this page and download the library: Download adrii/zendesk-api 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/ */
adrii / zendesk-api example snippets
use Adrii\ZendeskAPI;
php
$data = array(
"username" => "1234qwer",
"type" => "problem",
"tags" => "ios,test",
"subject" => "Test",
"body" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean tempor semper enim. Nam non semper ligula. Vestibulum sapien sapien, hendrerit pharetra elementum a, faucibus id nisl. Aenean ornare rhoncus ligula, eget efficitur augue suscipit vehicula. Fusce faucibus odio magna, sit amet aliquet ipsum sodales a.",
"first_name" => "Adrii",
"last_name" => "🍍",
"email" => "[email protected] ",
);
for ($i = 0; $i < count($files); $i++) {
$zendesk->upload($files[$i]['name'], $files[$i]['tmp_name']);
}
$comment = array(
array(
'type' => $data['type'],
'tags' => explode(",", $data['tags']),
'subject' => $data['subject'],
'comment' => array(
'body' => $data['body'],
'public' => false,
"uploads" => $zendesk->getUpload()
),
'requester' => array(
'locale_id' => '1',
'name' => $data['first_name'] . " " . $data['last_name'],
'email' => $data['email'],
),
'priority' => 'normal',
)
);
$subdomain = "{subdomain}";
$user = "{user}";
$token = "{token}";
$zend = new ZendeskApi($subdomain, $user, $token);
$zend->create($comment);