Skip to content

Commit 813a990

Browse files
committed
trying something different
1 parent 4a52ce1 commit 813a990

File tree

2 files changed

+22
-24
lines changed

2 files changed

+22
-24
lines changed

src/CitrixAbstract.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ abstract class CitrixAbstract
2121

2222
private $verify_ssl = false;
2323

24-
private $http_client;
24+
private $client;
2525

2626
private $authObject; //holds all the values after auth
2727

@@ -172,9 +172,9 @@ public function getResponseCollection()
172172
public function sendRequest()
173173
{
174174

175-
if (!$this->http_client instanceof HttpClient) {
175+
if (!$this->client instanceof HttpClient) {
176176

177-
$this->http_client = new HttpClient([
177+
$this->client = new HttpClient([
178178
'base_uri' => $this->base_uri,
179179
'port' => $this->port,
180180
'timeout' => $this->timeout,
@@ -189,7 +189,7 @@ public function sendRequest()
189189

190190
case 'GET':
191191

192-
$this->httpResponse = $this->http_client->get($this->getUrl(), [
192+
$this->httpResponse = $this->client->get($this->getUrl(), [
193193
'headers' => [
194194
'Content-Type' => 'application/json; charset=utf-8',
195195
'Accept' => 'application/json',
@@ -201,7 +201,7 @@ public function sendRequest()
201201

202202
case 'POST':
203203

204-
$this->httpResponse = $this->http_client->post($this->getUrl(), [
204+
$this->httpResponse = $this->client->post($this->getUrl(), [
205205
'headers' => [
206206
'Content-Type' => 'application/json; charset=utf-8',
207207
'Accept' => 'application/json',
@@ -213,7 +213,7 @@ public function sendRequest()
213213

214214
case 'PUT':
215215

216-
$this->httpResponse = $this->http_client->put($this->getUrl(), [
216+
$this->httpResponse = $this->client->put($this->getUrl(), [
217217
'headers' => [
218218
'Content-Type' => 'application/json; charset=utf-8',
219219
'Accept' => 'application/json',
@@ -225,7 +225,7 @@ public function sendRequest()
225225

226226
case 'DELETE':
227227

228-
$this->httpResponse = $this->http_client->delete($this->getUrl(), [
228+
$this->httpResponse = $this->client->delete($this->getUrl(), [
229229
'headers' => [
230230
'Content-Type' => 'application/json; charset=utf-8',
231231
'Accept' => 'application/json',

src/DirectAuthenticate.php

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Slakbal\Citrix;
44

55
use GuzzleHttp\Client as HttpClient;
6-
use GuzzleHttp\ClientInterface;
76

87
class DirectAuthenticate
98
{
@@ -51,24 +50,25 @@ public function authenticate()
5150
'client_id' => $this->client_id,
5251
];
5352

54-
if (version_compare(ClientInterface::VERSION, '6') === 1) {
55-
$options = ['form_params' => $params];
56-
} else {
57-
$options = ['body' => $params];
58-
}
53+
$url = '/oauth/access_token?grant_type='.$this->grant_type.'&user_id='.$this->username.'&password='.$this->password.'&client_id='.$this->client_id;
5954

60-
$this->response = $this->client->post('/oauth/access_token', $options);
61-
62-
/*
63-
$this->response = $this->http_client->get('/oauth/access_token', [
64-
'header' => [
55+
$this->response = $this->client->get($url, [
56+
'header' => [
6557
'Content-Type' => 'application/x-www-form-urlencoded',
6658
'Accept' => 'application/json',
67-
],
68-
'query' => $params,
69-
'form_params' => $params,
59+
]
7060
]);
71-
*/
61+
62+
63+
// $this->response = $this->client->get('/oauth/access_token', [
64+
// 'header' => [
65+
// 'Content-Type' => 'application/x-www-form-urlencoded',
66+
// 'Accept' => 'application/json',
67+
// ],
68+
// 'query' => $params,
69+
// //'form_params' => $params,
70+
// ]);
71+
7272
// 'headers' => [
7373
// 'Content-Type' => 'application/x-www-form-urlencoded',
7474
// 'Accept' => 'application/json',
@@ -90,8 +90,6 @@ public function authenticate()
9090

9191
$this->response = $this->response->getBody();
9292

93-
//dd( (string)$this->response );
94-
9593
$this->response = json_decode($this->response, false, 512, JSON_BIGINT_AS_STRING);
9694

9795
return $this->response;

0 commit comments

Comments
 (0)