我无法使用 shopify Api 获取 page_info

0 shopify-api

我正在进行 Shopify 版本控制,因为我无法获取页面数据。我回顾了 API 新版本,因为我显示了 page_info 在哪里获取 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;
Run Code Online (Sandbox Code Playgroud)

Bha*_*ara 5

如果您使用 REST API,那么您将在响应标头中获取它。看看下面的响应头屏幕截图。

在此输入图像描述

下面的帖子可能会帮助您了解如何从响应标头中提取此 pageInfo

如何使用 PHP 在 Shopify Rest API 中创建分页