需要拉使用eBay getsellerlist API函数使用XML和PHP所有产品 [英] Need to pull all products using eBay getsellerlist api function using XML and PHP

查看:212
本文介绍了需要拉使用eBay getsellerlist API函数使用XML和PHP所有产品的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让所有的产品从用户的易趣账户,但是当我运行我的code,我只得到几百。我可以证实,有2 000种产品。

我怎样才能把所有的产品不使用的开始和结束的时间和日期参数?

如果我删除code的线条与< StartTimeFrom> < EndTimeTo> 也没有任何产品都没有。

  $ URL ='https://api.ebay.com/ws/api.dll';
$ USER_NAME ={用户名是在这里};
$的auth_token ={令牌这里};
为($ i = 1; $ I< = 10; $ I ++){
    $头=阵列(
      内容类型:文本/ XML,
      X-EBAY-API兼容性-LEVEL:877',
      X-EBAY-API-DEV-NAME:177b0624-2d99-428a-8659-7404d9043c76',
      X-EBAY-API-APP-NAME:PeteNayl-d415-49bb-a950-495237441c1c',
      X-EBAY-API-CERT-NAME:6c336965-1a1f-4d11-94b1-3843c3ac995b',
      X-EBAY-API SITEID:3',
      X-EBAY-API-CALL-NAME:GetSellerList
    );    $ XML ='< XML版本=1.0编码=UTF-8&GT?;
    < GetSellerListRequest的xmlns =金塔:易趣:蜜蜂:eBLBaseComponents>
    < RequesterCredentials>
    < eBayAuthToken>&LT'$的auth_token。'; / eBayAuthToken>
    < / RequesterCredentials>
    <分页的ComplexType =PaginationType>
        &所述; EntriesPerPage> 200℃; / EntriesPerPage>
    <&的PageNumber GT;&LT'$我。'; /&的PageNumber GT;
    < /分页>
    &所述; StartTimeFrom> 2014-06-01T21:59:59.005Z&下; / StartTimeFrom>
    &所述; StartTimeTo> 2014-06-02T21:59:59.005Z&下; / StartTimeTo>
    &所述; EndTimeFrom> 2014-09-29T21:59:59.005Z&下; / EndTimeFrom>
    &所述; EndTimeTo> 2014-09-30T21:59:59.005Z&下; / EndTimeTo>
    < D​​etailLevel> ItemReturnDescription< / DetailLevel>
    <用户名>&LT'$ USER_NAME。'; /用户名>
    < / GetSellerListRequest>';...


解决方案

您不能没有一个时间范围,并且发送一个请求之间的时间距离,并不能超过120天。如果你想拉的所有产品支持你将不得不做出多个请求的 GetSellerList 的每个请求的覆盖特定120天期。

信息可以在易趣文档中的两个<一中找到href=\"http://developer.ebay.com/DevZone/XML/docs/Reference/eBay/GetSellerList.html#Request.EndTimeFrom\"相对=nofollow> EndTimeFrom 和<一个href=\"http://developer.ebay.com/DevZone/XML/docs/Reference/eBay/GetSellerList.html#Request.StartTimeFrom\"相对=nofollow>请求StartTimeFrom 领域。请注意,文件不说需要的字段,但它不包括他们在您的请求中的失败的值将在确认的返回现场响应

I am trying to get all products from a user's ebay account, but when I run my code I am only getting a few hundred. I can confirm there are 2 000 products.

How can I pull all products without using the start and end time and date parameters?

If I remove the lines of code with the <StartTimeFrom> to <EndTimeTo> it shows no products at all.

$url = 'https://api.ebay.com/ws/api.dll';
$user_name  = "{username is in here}";
$auth_token = "{token is in here}";
for ($i = 1; $i <= 10; $i++) {
    $headers = array(
      'Content-Type: text/xml',
      'X-EBAY-API-COMPATIBILITY-LEVEL:877',
      'X-EBAY-API-DEV-NAME:177b0624-2d99-428a-8659-7404d9043c76',
      'X-EBAY-API-APP-NAME:PeteNayl-d415-49bb-a950-495237441c1c',
      'X-EBAY-API-CERT-NAME:6c336965-1a1f-4d11-94b1-3843c3ac995b',
      'X-EBAY-API-SITEID:3',
      'X-EBAY-API-CALL-NAME:GetSellerList'
    );

    $xml = '<?xml version="1.0" encoding="utf-8"?>
    <GetSellerListRequest xmlns="urn:ebay:apis:eBLBaseComponents">
    <RequesterCredentials>
    <eBayAuthToken>'.$auth_token.'</eBayAuthToken>
    </RequesterCredentials>
    <Pagination ComplexType="PaginationType">
        <EntriesPerPage>200</EntriesPerPage>
    <PageNumber>'.$i.'</PageNumber>
    </Pagination>
    <StartTimeFrom>2014-06-01T21:59:59.005Z</StartTimeFrom>
    <StartTimeTo>2014-06-02T21:59:59.005Z</StartTimeTo>
    <EndTimeFrom>2014-09-29T21:59:59.005Z</EndTimeFrom>
    <EndTimeTo>2014-09-30T21:59:59.005Z</EndTimeTo>
    <DetailLevel>ItemReturnDescription</DetailLevel>
    <UserID>'.$user_name.'</UserID>
    </GetSellerListRequest>';

...

解决方案

You cannot send a request without a time range and that the period between the from and to cannot exceed 120 days. If you want to pull all the products back you are going to have to make multiple requests to GetSellerList where each request covers a particular 120 day period.

Information can be found in the eBay documentation for the both the EndTimeFrom and StartTimeFrom fields in the request. Note that the documentation does not say that the fields are required, but it you do not include them in your request a Failure value will be returned in the Ack field of the response.

这篇关于需要拉使用eBay getsellerlist API函数使用XML和PHP所有产品的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆