From b0b6fbaaa1098e1d189e14cf1034774d488f5f49 Mon Sep 17 00:00:00 2001 From: BOCKTAELS Hugo Date: Wed, 22 Feb 2023 10:55:46 +0100 Subject: [PATCH] Adding queryParams in curl call using http_build_query() we can simply pass the parameters describe in the Api doc. ex : $this->pb->collection('coolCollection')->getFullList(200,['filter'=> $filter]) It can be used for all other function. --- src/Collection.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Collection.php b/src/Collection.php index bee1dda..c09afe9 100644 --- a/src/Collection.php +++ b/src/Collection.php @@ -40,7 +40,8 @@ class Collection public function getFullList(int $batch = 200, array $queryParams = []) { $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); if (self::$token != '') { $headers = array(