Note that there are some explanatory texts on larger screens.

plurals
  1. POCitrix PHP cURL oAuth invalidKey
    primarykey
    data
    text
    <p>I am having problems with this and I don't know if anyone can help. I am having an issue with getting an oAuth key I think for this. The error I keep getting back is inValidKey and I have researched and researched. Maybe I just don't get it, but I cannot seem to pin this one.</p> <pre><code>&lt;?php class ApiClient { private $oauthToken; public function __construct($oauthToken) { $this-&gt;oauthToken = $oauthToken; } public function post($url, $data) { $data_string = json_encode($data); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string); curl_setopt($ch, CURLOPT_TIMEOUT, '10'); $headers = array( "Content-Type: application/json", "Accept: application/json", "Authorization: OAuth oauth_token={$this-&gt;oauthToken}", "Content-Length: " . strlen($data_string) ); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $ret = curl_exec($ch); return json_decode($ret); } public function get($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_TIMEOUT, '10'); $headers = array( "Content-Type: application/json", "Accept: application/json", "Authorization: OAuth oauth_token={$this-&gt;oauthToken}" ); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $ret = curl_exec($ch); return json_decode($ret); } } class Webinar { private $developerKey; private $organizerKey; protected $client; // ########################## private $apps = array( 'MMT' =&gt; array( 'developerKey' =&gt; '#######################3', 'oauthToken' =&gt; '', 'organizerKey' =&gt; '') ); public function __construct($app = 'MMT') { if(!array_key_exists($app, $this-&gt;apps)) { throw new Exception('Invalid argument: unknown developer key'); } $this-&gt;developerKey = $this-&gt;apps[$app]['developerKey']; $this-&gt;organizerKey = $this-&gt;apps[$app]['organizerKey']; $this-&gt;client = new ApiClient($this-&gt;apps[$app]['oauthToken']); } public function getUpcoming() { return $this-&gt;client-&gt;get("https://api.citrixonline.com/G2W/rest/organizers/{$this-&gt;organizerKey}/upcomingWebinars"); } public function getHistorical() { return $this-&gt;client-&gt;get("https://api.citrixonline.com/G2W/rest/organizers/{$this-&gt;organizerKey}/historicalWebinars"); } public function addRegistrant($webinarKey, $email, $firstname, $lastname) { $url = "https://api.citrixonline.com/G2W/rest/organizers/{$this-&gt;organizerKey}/webinars/{$webinarKey}/registrants"; $data = (object) array( 'firstName' =&gt; $firstname, 'lastName' =&gt; $lastname, 'email' =&gt; $email ); return $this-&gt;client-&gt;post($url, $data); } } //**************************************************** $api = new Webinar(); print_r($api-&gt;getUpcoming)); ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload