AnsweredAssumed Answered

How to deal with pagination in Canvas using PHP

Question asked by Fabio Cunha on Aug 12, 2019
Latest reply on Aug 12, 2019 by James Jones

I was trying to use pagination in my requests, I just try to show the Header that contains the "Link" values.

I use Guzzle with PHP


$res_aluno_pag = $client->request('GET', 'courses/'.$course_id.'/enrollments?type[]=StudentEnrollment&state[]=active&per_page=1000', ['headers' => $headers
var_export( $res_aluno_pag->getHeader("Link") );

This is the what appear in my screen

array ( 0 => '; rel="current",; rel="next",; rel="first",; rel="last"', )

But if I use postman, I can see the following result inside the "Headers" tab


<>; rel="current",
<>; rel="prev",
<>; rel="first",
<>; rel="last"

How can I use PHP and Guzzle to see the complete text/string that is inside the "Link" Header?