-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRestClient.php
More file actions
432 lines (367 loc) · 24.5 KB
/
RestClient.php
File metadata and controls
432 lines (367 loc) · 24.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
<?php
/*
* RestClient
* REST client for PHP, Allows a php server to make requests to other domains (Cross Site)
* Cliente REST para PHP, Permite desde un servidor php hacer peticiones a otros dominios (Cross Site)
* Version: 3.0
* Programmer: Eidy Estupiñan Varona <eidyev@gmail.com>
* Requirements: PHP CURL Extension php-curl
*/
class RestClient
{
//Enviroment atributes //Atributos Generales
//--------------------------------------------------------------------------------------------------------
private $useragent; //User agent //User agent simula al de un navegador Firefox 75 en Windows 10
private $timeout = 10; //Time Out //Tiempo de espera para la conexión
private $cookieFileLocation; //Cookie FIle //Fichero de Cookies para en caso del que el sitio las cree
private $referer = null; //Referrer //Indica quien refirió para hacer la petición
private $verificSSL = false;
private $validSSL = null;
private $error = null;
//Request atributes //Atributos de la petición
//-------------------------------------------------------------------------------------------------------
private $request_url = ''; //Request URL //URL a la cual se hará la petiión
private $request_port = null; //Request Port //Puerto detino en casod e que se use otro
private $request_method = 'GET'; //Request Method //Método a usar en las peticiones GET,POST,PUT,DELETE
private $request_parameters = null; //Request parameters //listado de parametros en la peticion
private $request_length = 0; //Request length //longitud de la lista de parametros de la petición
private $request_accept_type = 'application/json'; //Request Accept Type //Typo de contenido que se esperará en el resultado
private $request_custom_headers = null; //Request custom headers //Cabeceras personalizadas, agregar keys para APIs etc
private $request_authentication_enabled = false; //Request Auth //Habilitar Autenticación
private $request_auth_username = null; //Request Username //Usuario
private $request_auth_password = null; //Request Password //Clave
//Response atributes //Atributos de la respuesta
//-------------------------------------------------------------------------------------------------------
private $response_status_code= null; //Response Sttus Code //Código de estado de la respuesta
private $response_type= null; //Response Type //Tipo de contenido de la respuesta
private $response_content_length = 0; //Response Content Length //Longitud del contenidod e la respuesta
private $response_info= null; //Response Info //Información completa de la respuesta
private $response_data= null; //Response Data //Datos de la respuesta
//Constructor
public function __construct ($url = null, $method = 'GET', $parameters = null)
{
$this->request_url = $url;
$this->request_method = $method;
$this->request_parameters = $parameters;
if ($this->request_parameters !== null)
$this->buildRequestParametersString($parameters);
$file = getcwd().DIRECTORY_SEPARATOR.'cookie.txt';
$file2= getcwd().DIRECTORY_SEPARATOR.'ca.pem';
if (file_exists($file))
unlink($file);
if (file_exists($file2))
unlink($file2);
$this->cookieFileLocation = $file;
$this->useragent = 'REST-Client-3.0';
}
//Function for build string of request parameters //Función para conformar la cadena de consulta con los parametros de la petición
public function buildRequestParametersString($data = null)
{
$data = ($data !== null) ? $data : $this->request_parameters;
if (!is_array($data))
throw new InvalidArgumentException('Invalid data input for parameters. Array expected');
$data = http_build_query($data, '', '&');
$this->request_parameters = $data;
$this->request_length = strlen($this->request_parameters);
}
//Execute request //Función para ejecutar la petición
public function execute()
{
//curl sesion init
$curlhandle = curl_init();
try
{
switch (strtoupper($this->request_method))
{
case 'GET':
$this->executeGet($curlhandle);
break;
case 'POST':
$this->executePost($curlhandle);
break;
case 'PUT':
$this->executePut($curlhandle);
break;
case 'DELETE':
$this->executeDelete($curlhandle);
break;
default:
throw new InvalidArgumentException('"'.$this->request_method.'" is an invalid REST request method.');
}
}
catch (InvalidArgumentException $e)
{
curl_close($curlhandle);
throw $e;
}
catch (Exception $e)
{
curl_close($curlhandle);
throw $e;
}
}
//Execute request by GET Method //Función para ejecutar la petición por el método GET
private function executeGet ($curlhandle)
{
if(!empty($this->request_parameters))
$this->request_url .= '?'.$this->request_parameters;
$this->doExecute($curlhandle);
}
//Execute request by POST Method //Función para ejecutar la petición por el método POST
private function executePost ($curlhandle)
{
if (!is_string($this->request_parameters))
$this->buildRequestParametersString();
curl_setopt($curlhandle, CURLOPT_POSTFIELDS, $this->request_parameters);
curl_setopt($curlhandle, CURLOPT_POST, TRUE);
curl_setopt($curlhandle, CURLOPT_BINARYTRANSFER, TRUE);
$this->doExecute($curlhandle);
}
//Execute request by PUT Method //Función para ejecutar la petición por el método PUT
private function executePut ($curlhandle)
{
if (!is_string($this->request_parameters))
$this->buildRequestParametersString();
$fh = fopen('php://memory', 'rw');
fwrite($fh, $this->request_parameters);
rewind($fh);
curl_setopt($curlhandle, CURLOPT_INFILE, $fh);
curl_setopt($curlhandle, CURLOPT_INFILESIZE, $this->request_length);
curl_setopt($curlhandle, CURLOPT_PUT, TRUE);
$this->doExecute($curlhandle);
fclose($fh);
}
//Execute request by DELETE Method //Función para ejecutar la petición por el método DELETE
private function executeDelete ($curlhandle)
{
curl_setopt($curlhandle, CURLOPT_CUSTOMREQUEST, 'DELETE');
if(!empty($this->request_parameters))
$this->request_url .= '?'.$this->request_parameters;
$this->doExecute($curlhandle);
}
//Execute request //Función para ejecutar la petición
private function doExecute (&$curlHandle)
{
$this->setCurlOpts($curlHandle);
$this->response_data = curl_exec($curlHandle);
$this->response_info = curl_getinfo($curlHandle);
$this->response_status_code = curl_getinfo($curlHandle,CURLINFO_HTTP_CODE);
$this->response_type = curl_getinfo($curlHandle,CURLINFO_CONTENT_TYPE);
$this->response_content_length = strlen($this->response_data);
if ($this->verificSSL)
$this->validSSL = curl_getinfo($curlHandle,CURLINFO_SSL_VERIFYRESULT);
if(curl_errno($curlHandle))
$this->error = 'Error: '.curl_error($curlHandle);
curl_close($curlHandle);
}
//Set CURL Options //Establecer parámetros al CURL
private function setCurlOpts(&$curlHandle)
{
curl_setopt($curlHandle, CURLOPT_USERAGENT,$this->useragent);
curl_setopt($curlHandle, CURLOPT_TIMEOUT, $this->timeout);
curl_setopt($curlHandle, CURLOPT_URL, $this->request_url);
if($this->request_port !== null)
curl_setopt($curlHandle, CURLOPT_PORT , $this->request_port);
if($this->referer !== null)
curl_setopt($curlHandle, CURLOPT_REFERER,$this->referer);
if($this->request_custom_headers !== null)
{
$custom_headers = $this->request_custom_headers;
$custom_headers_keys = array_keys($custom_headers);
$custom_headers_strs = array('Accept: '. $this->request_accept_type);
for($i=0;$i<count($custom_headers_keys);$i++)
{
$key=$custom_headers_keys[$i];
$valor=$custom_headers[$key];
$custom_headers_strs[]= $key.': '.$valor;
}
curl_setopt($curlHandle, CURLOPT_HTTPHEADER, $custom_headers_strs);
}
else
curl_setopt($curlHandle, CURLOPT_HTTPHEADER, array('Accept: '. $this->request_accept_type));
if ($this->request_authentication_enabled && ($this->request_username !== null && $this->request_password !== null))
{
curl_setopt($curlHandle, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curlHandle, CURLOPT_USERPWD, $this->request_username.':'.$this->request_password);
}
curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curlHandle, CURLOPT_COOKIEFILE,$this->cookieFileLocation);
if ($this->verificSSL)
{
curl_setopt($curlHandle, CURLOPT_CAINFO, getcwd().DIRECTORY_SEPARATOR.'ca.pem');
curl_setopt($curlHandle, CURLOPT_CAPATH, getcwd().DIRECTORY_SEPARATOR.'ca.pem');
curl_setopt($curlHandle, CURLOPT_SSL_VERIFYPEER, TRUE);
curl_setopt($curlHandle, CURLOPT_SSL_VERIFYHOST, 2);
}
else
{
curl_setopt($curlHandle, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($curlHandle, CURLOPT_SSL_VERIFYPEER, FALSE);
}
}
//Getters and Setters functions //Funciones para obtención y seteo de atributos
//------------------------------------------------------------------------------------------------------------------------------------
public function getUseragent() {
return $this->useragent;
}
public function setUseragent($useragent) {
$this->useragent = $useragent;
return $this;
}
public function getTimeout() {
return $this->timeout;
}
public function setTimeout($timeout) {
$this->timeout = $timeout;
return $this;
}
public function getCookieFileLocation() {
return $this->cookieFileLocation;
}
public function setCookieFileLocation($cookieFileLocation) {
$this->cookieFileLocation = $cookieFileLocation;
return $this;
}
public function getReferer() {
return $this->referer;
}
public function setReferer($referer) {
$this->referer = $referer;
return $this;
}
public function getVerificSSL() {
return $this->verificSSL;
}
public function setVerificSSL($verificSSL) {
$this->verificSSL = $verificSSL;
return $this;
}
public function getValidSSL() {
return $this->validSSL;
}
public function getRequest_url() {
return $this->request_url;
}
public function setRequest_url($request_url) {
$this->request_url = $request_url;
return $this;
}
public function getRequest_port() {
return $this->request_port;
}
public function setRequest_port($request_port) {
$this->request_port = $request_port;
return $this;
}
public function getRequest_method() {
return $this->request_method;
}
public function setRequest_method($request_method) {
$this->request_method = $request_method;
return $this;
}
public function getRequest_parameters() {
return $this->request_parameters;
}
public function setRequest_parameters($request_parameters) {
$this->request_parameters = $request_parameters;
return $this;
}
public function getRequest_length() {
return $this->request_length;
}
public function getRequest_accept_type() {
return $this->request_accept_type;
}
public function setRequest_accept_type($request_accept_type) {
$this->request_accept_type = $request_accept_type;
return $this;
}
public function getRequest_custom_headers() {
return $this->request_custom_headers;
}
public function setRequest_custom_headers($array_custom_headers) {
if (!is_array($array_custom_headers))
throw new InvalidArgumentException('Invalid data input for $request_custom_headers. Array expected');
$this->request_custom_headers = $array_custom_headers;
return $this;
}
public function addRequest_custom_header($key,$value) {
$this->request_custom_headers[]= $key.': '.$value;
return $this;
}
public function getRequest_authentication_enabled() {
return $this->request_authentication_enabled;
}
public function setRequest_authentication_enabled($request_authentication_enabled) {
$this->request_authentication_enabled = $request_authentication_enabled;
return $this;
}
public function getRequest_auth_username() {
return $this->request_auth_username;
}
public function setRequest_auth_username($request_auth_username) {
$this->request_auth_username = $request_auth_username;
return $this;
}
public function getRequest_auth_password() {
return $this->request_auth_password;
}
public function setRequest_auth_password($request_auth_password) {
$this->request_auth_password = $request_auth_password;
return $this;
}
public function getResponse_status_code() {
return $this->response_status_code;
}
public function getResponse_type() {
return $this->response_type;
}
public function getResponse_content_length() {
return $this->response_content_length;
}
public function getResponse_info() {
return $this->response_info;
}
public function getResponse_data() {
return $this->response_data;
}
public function getResponse_data_json_decode()
{
return json_decode($this->response_data);
}
//Function Execute and Explain, use only for test and diagnostic //Funcion para ejecutar y ver salida detalla, usar para prueba y diagnóstico
public function executeAndExplain()
{
$this->execute();
echo '<!DOCTYPE html><html><head><title>RestClient | Execute and Explain </title>';
echo '<style type="text/css"> body {background-color: #fff; color: #222; font-family: sans-serif;} pre {margin: 0; font-family: monospace;} table {border-collapse: collapse; border: 0; width: 900px; box-shadow: 1px 2px 3px #ccc;} .center {text-align: center;} .center table {margin: 1em auto; text-align: left;} .center th {text-align: center !important;} td, th {border: 1px solid #666; font-size: 75%; vertical-align: baseline; padding: 4px 5px;} h1 {font-size: 150%;} h2 {font-size: 125%;} .p {text-align: left;} .e {background-color: #ccf; width: 150px; font-weight: bold;} .h {background-color: #99c; font-weight: bold;} .v {background-color: #ddd; max-width: 300px; overflow-x: auto; word-wrap: break-word;} .v i {color: #999;} img {float: right; border: 0;height: 45px;} hr {width: 934px; background-color: #ccc; border: 0; height: 1px;} </style>';
echo '</head> <body> <div class="center"> <table> <tr class="h"><td> <a href="#"><img border="0" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHkAAABACAYAAAA+j9gsAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAD4BJREFUeNrsnXtwXFUdx8/dBGihmE21QCrQDY6oZZykon/gY5qizjgM2KQMfzFAOioOA5KEh+j4R9oZH7zT6MAMKrNphZFSQreKHRgZmspLHSCJ2Co6tBtJk7Zps7tJs5t95F5/33PvWU4293F29ybdlPzaM3df2XPv+Zzf4/zOuWc1tkjl+T0HQ3SQC6SBSlD6WKN4rusGm9F1ps/o5mPriOf8dd0YoNfi0nt4ntB1PT4zYwzQkf3kR9/sW4xtpS0CmE0SyPUFUJXFMIxZcM0jAZ4xrKMudQT7963HBF0n6EaUjkP0vI9K9OEHWqJLkNW1s8mC2WgVTwGAqWTafJzTWTKZmQuZ/k1MpAi2+eys6mpWfVaAPzcILu8EVKoCAaYFtPxrAXo8qyNwzZc7gSgzgN9Hx0Ecn3j8xr4lyHOhNrlpaJIgptM5DjCdzrJ0Jmce6bWFkOpqs0MErA4gXIBuAmY53gFmOPCcdaTXCbq+n16PPLXjewMfGcgEttECeouTpk5MplhyKsPBTiXNYyULtwIW7Cx1vlwuJyDLR9L0mQiVPb27fhA54yBbGttMpc1OWwF1cmKaH2FSF7vAjGezOZZJZ9j0dIZlMhnuRiToMO0c+N4X7oksasgEt9XS2KZCHzoem2Ixq5zpAuDTqTR14FMslZyepeEI4Ogj26n0vLj33uiigExgMWRpt+CGCsEePZqoePM738BPTaJzT7CpU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9XPypwX29ufWgudq0urrKes/8nPkxgy1bdg6z/or/SFc2mzV/xs+6HwySTmdYJp2dpaWKEregYrVfn9/B0xkD2U6+e+sOaHqImTfLrycUOIZM1hJwC3oemPXbi/y5PnsrJ136bUa8pxu69BklmANWwDRkgR1wmwVaglyi3Nz6JLQ+ZG5NxQsgNdAhmIfJN7wxgoWg9fxzPQ+c/g9YAIXgeUKCyipJO4uR/wswAOIwB/5IgxvbAAAAAElFTkSuQmCC" alt="PHP logo" /></a><h1 class="p">PHP RestClient Version 3</h1></td></tr>';
echo '</table> <table><tr> <td class="e" colspan="2" >General Options / Opciones Generales</td> </tr>
<tr> <td class="e">User Agent</td> <td class="v">'.$this->useragent.'</td></tr>
<tr> <td class="e">Time Out</td> <td class="v">'.$this->timeout.' secunds</td></tr>
<tr> <td class="e">Cookie File</td> <td class="v">'.$this->cookieFileLocation.'</td></tr>
<tr> <td class="e">Referer Used</td> <td class="v">'.$this->referer.'</td></tr>
<tr> <td class="e">Verific SSL</td> <td class="v">'.$this->verificSSL.'</td></tr>
<tr> <td class="e">Valid SSL</td> <td class="v">'.(($this->validSSL == 0)?'Ok':'Fail').'</td></tr>
<tr> <td class="e">Error</td> <td class="v">'.$this->error.'</td></tr>
</table> <table><tr> <td class="e" colspan="2" >Request Options / Opciones de Petición</td> </tr>
<tr> <td class="e">Request URL</td> <td class="v">'.$this->request_url.'</td></tr>
<tr> <td class="e">Request Port</td> <td class="v">'.$this->request_port.'</td></tr>
<tr> <td class="e">Request Method</td> <td class="v">'.$this->request_method.'</td></tr>
<tr> <td class="e">Request Parameters</td> <td class="v">';print_r($this->request_parameters);echo '</td></tr>
<tr> <td class="e">Request Length</td> <td class="v">'.$this->request_length.'</td></tr>
<tr> <td class="e">Request Accept Type</td> <td class="v">'.$this->request_accept_type.'</td></tr>
<tr> <td class="e">Request Custom Headers</td> <td class="v">';print_r($this->request_custom_headers); echo'</td></tr>
<tr> <td class="e">Request Authentication</td> <td class="v">'.$this->request_authentication_enabled.'</td></tr>
<tr> <td class="e">Request Auth. User </td> <td class="v">'.$this->request_auth_username.'</td></tr>
<tr> <td class="e">Request Auth. Password</td> <td class="v">'.$this->request_auth_password.'</td></tr>
</table> <table><tr> <td class="e" colspan="2" >Response Options / Opciones de Respuesta</td> </tr>
<tr> <td class="e">Response Status Code</td> <td class="v">'.$this->response_status_code.'</td></tr>
<tr> <td class="e">Response Content Type</td> <td class="v">'.$this->response_type.'</td></tr>
<tr> <td class="e">Response Content Length</td> <td class="v">'.$this->response_content_length.'</td></tr>
<tr> <td class="e">Response Info</td> <td class="v">';print_r($this->response_info); echo'</td></tr>
<tr> <td class="e">Response Data</td> <td class="v">';var_dump($this->response_data);
echo '</td></tr></table> </body></html>';
}
}