cURL needing to loop through all “next_page”

Question

When using cURL, how would I be able to include a call inside my get_all that basically will loop through all the next_pages, get the data and then outpul it to $response->data when the “next_page” parameter becomes null?

Here is the method:

public function get_all()
{
    return $response->data;
}

This is what $response->data is returning as of now (The cURL code wasn’t included here):

"paginator": {
    "total": 3092,
    "per_page": 500,
    "current_page": 2,
    "last_page": 7,
    "prev_page": "https://oc.com/api/v1/employees/?page=1",
    "next_page": "https://oc.com/api/v1/employees/?page=3"
},
"data": [
        {
            "id": 1592,
        etc....
0
, , Sema 3 years 2019-10-30T07:57:41-05:00 0 Answers 70 views 0

Leave an answer

Browse
Browse