Merge pull request #2 from HolyHugo/useQueryParams_getFullList

Adding queryParams in curl call
This commit is contained in:
Jonathan Martz
2023-02-24 11:45:04 +01:00
committed by GitHub

View File

@@ -40,7 +40,8 @@ class Collection
public function getFullList(int $batch = 200, array $queryParams = []) public function getFullList(int $batch = 200, array $queryParams = [])
{ {
$ch = curl_init(); $ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $this->url . "/api/collections/" . $this->collection . "/records"); $getParams = !empty($queryParams) ? http_build_query($queryParams) : "";
curl_setopt($ch, CURLOPT_URL, $this->url . "/api/collections/" . $this->collection . "/records?".$getParams);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
if (self::$token != '') { if (self::$token != '') {
$headers = array( $headers = array(