Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

uiop's avatar
Level 1

let me explain, how to set pagination

the data from external API using cURL get request with domain and fields.how to set pagination with offset.

public function search_with_date_range($date_from,$date_to)
    {
        $customer = Customer::find(Auth::id());
        $curl = curl_init();
        curl_setopt_array($curl, array(
            CURLOPT_URL => $this->api_url.'/apilink/',
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_ENCODING => '',
            CURLOPT_MAXREDIRS => 10,
            CURLOPT_TIMEOUT => 0,
            CURLOPT_FOLLOWLOCATION => true,
            CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
            CURLOPT_CUSTOMREQUEST => 'GET',
            CURLOPT_POSTFIELDS => array(                
                'db' => 'name',
                'domain' => '[(\'id\',\'=\')]',
                'fields' => '[\'name\']',
'order' => 'id desc'
            ),
            CURLOPT_HTTPHEADER => array(
                'access-token: '.Auth::user()->access_token,
                
            ),
        ));
        $response = curl_exec($curl);
        $httpcode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
        curl_close($curl);
        $search_result = json_decode($response);
        return $search_result;
0 likes
0 replies

Please or to participate in this conversation.