首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Etsy PHP交付选项

Etsy PHP交付选项
EN

Stack Overflow用户
提问于 2016-02-10 12:16:14
回答 2查看 672关注 0票数 4

使用Etsy清单API,我返回了与关键字匹配的列表,并且我可以对它们进行分页,没有问题。

然而,我只想找到那些提供给英国的上市公司。

我尝试使用region的网址参数,但我仍然得到的项目,只能交付到美国。

有人能帮我理解一下我需要通过什么才能得到英国可运输的物品吗?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2016-02-19 12:18:26

如果你只想使用可以运往英国的清单,你必须看一下列表中的ShippingInfo。我就是这样做的:

代码语言:javascript
复制
$json = file_get_contents("https://openapi.etsy.com/v2/listings/active?keywords=ISBN&region=GB&includes=ShippingInfo(destination_country_id)&api_key=");
$listings = json_decode($json, true);
foreach($listings['results'] as $listing) {
    if (isset($listing['ShippingInfo'])) {
        foreach ($listing['ShippingInfo'] as $shipping) {
            if ($shipping['destination_country_id'] == 105) {
                //this listing ships to UK
                print_r($listing);
            }       
        }

    }
}
票数 2
EN

Stack Overflow用户

发布于 2016-02-20 12:37:27

以下是船舶/送货到“联合王国”的清单代码

代码语言:javascript
复制
<?php
$apiContent = file_get_contents("https://openapi.etsy.com/v2/listings/active?api_key=YOUR-API-KEY-HERE&includes=ShippingInfo(destination_country_name)");
        $contentDecode = json_decode($apiContent, true);
        $total=0;
        foreach ($contentDecode['results'] as $row) {
            if (isset($row['ShippingInfo'])) {
                foreach ($row['ShippingInfo'] as $r) {
                    if ($r['destination_country_name'] == "United Kingdom") {
                        echo "<pre>";
                        print_r($row);
                        $total++;
                    }
                }
            }
        }
        echo $total;
?>

我使用includes=ShippingInfo(destination_country_name)参数来获取清单的发送细节。它得到了哪个国家的上市将交付。希望它能对你有用。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/35315047

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档