mirror of
https://github.com/jonathan-martz/pocketbase-php-sdk.git
synced 2026-04-03 07:27:42 +00:00
add token auth
This commit is contained in:
@@ -19,6 +19,13 @@ class Collection
|
|||||||
$ch = curl_init();
|
$ch = curl_init();
|
||||||
curl_setopt($ch, CURLOPT_URL, $this->url . "/api/collections/".$this->collection."/records");
|
curl_setopt($ch, CURLOPT_URL, $this->url . "/api/collections/".$this->collection."/records");
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||||
|
if(self::$token != ''){
|
||||||
|
$headers = array(
|
||||||
|
'Content-Type:application/json',
|
||||||
|
'Authorization: '.self::$token
|
||||||
|
);
|
||||||
|
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
||||||
|
}
|
||||||
$output = curl_exec($ch);
|
$output = curl_exec($ch);
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user