【问题标题】:php curl is not working in shopify api properlyphp curl 在shopify api中无法正常工作
【发布时间】:2016-01-03 02:05:14
【问题描述】:

PHP curl 在 Shopify API 中无法正常工作。有时它会起作用,我会收到 Shopify 的回复,但最长时间我没有收到回复或 504 网关超时。但它在邮递员中完美运行。

卷曲代码:

$url = "https://refiral5-2.myshopify.com/admin/script_tags.json";
$shops_token = '64cbba144bc3cb166da91be13103f785';

$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HTTPGET, true);
curl_setopt($curl, CURLOPT_HEADER, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_MAXREDIRS, 3);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER["HTTP_USER_AGENT"]);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 60);
curl_setopt($curl, CURLOPT_TIMEOUT, 60);
curl_setopt($curl, CURLOPT_HTTPHEADER, array("X-Shopify-Access-Token: $shops_token"));
$response = curl_exec($curl);
curl_close($curl);

【问题讨论】:

  • 错误日志? php版本?

标签: php api curl shopify postman


【解决方案1】:

当我尝试发布包含太多图片的产品时,我收到了 504 网关超时错误。我的理论是 Shopify 处理 API 请求有时间限制,所以如果您的请求需要 Shopify 很长时间才能处理,那么它将返回此错误。

【讨论】:

    猜你喜欢
    • 2014-07-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-08-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-05-13
    相关资源
    最近更新 更多