使用Shopify中的PHP的无效API密钥或访问令牌(无法识别的登录名或错误密码)

时间:2018-07-24 16:25:29

标签: php url curl shopify

我想通过使用此URL从shopify商店获取资源 $ API_KEY ='API密钥'; //我在这里使用适当的值

 $SECRET = 'api secret key'; //i use proper value here
  $TOKEN = 'your-secret-here'; //i use proper value here
  $STORE_URL = 'my store name.myshopify.com'; //i use proper value here
  $PRODUCT_ID = 'product-id-here';

 $url = 'https://' . $API_KEY . ':' . $SECRET . '@' . $STORE_URL . '/admin/orders' . '.json';
echo $url;
echo "<br>";

    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, $url);
    curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/json; charset=utf-8'));
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_VERBOSE, 0);
    curl_setopt($curl, CURLOPT_HEADER, 0);
    curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "GET");
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
    $response = curl_exec ($curl);
    $shop = json_decode($response);

    echo "<pre>";
    print_r($shop);

    echo "</pre>";
    curl_close ($curl);

    exit();

上面是我购物车中重定向文件上写的代码,我想在这里显示我的详细信息,例如商店,订单等

但是我发现以下显示的错误

stdClass对象 (     [错误] => [API]无效的API密钥或访问令牌(无法识别的登录名或错误的密码) )

0 个答案:

没有答案