Patel Heni
Patel Heni

Reputation: 9

i can not able to get page_info using shopify Api

I am doing Shopify versioning in that I can not get page wise data. I review API new version in that I show page_info where to I get page_info

$api_url = 'https://6b4c824f22b4f24ddewwerew0a9b36397fd27e5c4:a5cb5dd808ec7392ewrewrwerwerwed8872be5aa5d3b1c@bacsolution-4.myshopify.com/admin/api/2020-01/products.json?limit='.$limit.';rel=next';


    //$api_url = 'https://'.$shop.'/admin/products.json?limit='.$limit.'&page='.$i.'';
    //$fieldstoselect = 'id,title,variants';
    $fieldstoselect = 'id,title';
    $api_url = $api_url.'&fields='.$fieldstoselect;

    $headr = array();
    $headr[] = 'Content-Type: application/json';
    //$headr[] = 'X-Shopify-Access-Token:'.$token;
    $ch = curl_init($api_url);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headr);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
    $res = curl_exec($ch);
    $response_all = json_decode($res);
    echo "<pre>";
    print_r($response_all);
    exit;

Upvotes: 0

Views: 3838

Answers (1)

Bhargav Kaklotara
Bhargav Kaklotara

Reputation: 1458

If you are using REST API then you will get it in the response header. have a look in below screenshot of response header.

enter image description here

And below post might help you on how to extract this pageInfo from response header

How to create pagination in shopify rest api using php

Upvotes: 5

Related Questions