我需要更多了解 eBay API 的工作原理

发布于 2024-10-29 00:44:29 字数 1456 浏览 2 评论 0原文

我已经在该网站中查看了 PHP 代码中的许多示例,但他们每次都使用不同的技术,而且一点也不简单!我已经下载了 ebaySession.phpkeys.php 文件。我已经成功集成了ebaysession类并与ebay取得了联系。但是如何使用 sendHttpRequest() 方法让我感到困惑。没有解释如何获取用户帐户信息。

许多教程还表明,eBaySession 类的构造函数将请求令牌作为最后一个参数,而我的文件将用户令牌作为第一个参数。与 eBay 的 API 文档存在许多不一致之处。我有一个带有令牌的测试用户帐户...

我也不明白为什么 eBaySession 构造函数需要 UserTokencallname 在 eBay 的示例中,调用名称和用户令牌包含在 XML 字符串中...

这是一个简单的问题,我在 eBay 文档中看不到明确的答案,我如何制作一个简单的问题调用然后检索变量中的结果/响应?我已经通过一个简单的搜索查询实现了这一点,但当它需要用户信息和身份验证时,似乎无法让它工作...此外,eBay 的搜索示例使用 URL 类型查询,例如

// Construct the findItemsByKeywords HTTP GET call
$apicall = "$endpoint?";
$apicall .= "OPERATION-NAME=findItemsByKeywords";
$apicall .= "&SERVICE-VERSION=$version";
$apicall .= "&SECURITY-APPNAME=$appid";
$apicall .= "&GLOBAL-ID=$globalid";
$apicall .= "&keywords=$safequery";

然后另一个示例使用:

///Build the request Xml string
$requestXmlBody = '<?xml version="1.0" encoding="utf-8" ?>';
$requestXmlBody .= '<FetchTokenRequest xmlns="urn:ebay:apis:eBLBaseComponents">';
$requestXmlBody .= "<SessionID>$theID</SessionID>";
$requestXmlBody .= '</FetchTokenRequest>';

XML 代码被放入 sendHttpRequest() 方法中。为什么?还有另一个执行相同操作的示例,它在 XML 内有一个 authToken,但 authToken 是在类构造函数中定义的...

有关使用 eBay PHP API 的任何一般建议将不胜感激。

I have looked at many examples in PHP codes within there site BUT they keep using different techniques each time and is not straightforward at all!. I've downloaded the ebaySession.php and keys.php files. I have successfully integrated the ebaysession class and have made contact with ebay. But how to use the sendHttpRequest() method confuses me. There is no explanation to how to get a user account information.

Many tutorials also show that the constructor for the eBaySession class has the request token as the last parameter whereas my file has User token as the first parameter. There are many inconsistencies with the API documentation from eBay. I have a test user account with a token in place...

What I also don't understand is why eBaySession constructor requires the UserToken & callname when in ebay's example (s) the call name and usertoken was included in an XML string...

A SIMPLE question that I cannot see a clear answer within the eBay docs, How do I make a simple call then retrive the results / response in a variable? I have achieved this with a simple search query, but can't seem to get it working when it requires user information and authentication... ALSO the search example that eBay had uses a URL type query e.g.

// Construct the findItemsByKeywords HTTP GET call
$apicall = "$endpoint?";
$apicall .= "OPERATION-NAME=findItemsByKeywords";
$apicall .= "&SERVICE-VERSION=$version";
$apicall .= "&SECURITY-APPNAME=$appid";
$apicall .= "&GLOBAL-ID=$globalid";
$apicall .= "&keywords=$safequery";

Then another example uses:

///Build the request Xml string
$requestXmlBody = '<?xml version="1.0" encoding="utf-8" ?>';
$requestXmlBody .= '<FetchTokenRequest xmlns="urn:ebay:apis:eBLBaseComponents">';
$requestXmlBody .= "<SessionID>$theID</SessionID>";
$requestXmlBody .= '</FetchTokenRequest>';

That XML code was put in the sendHttpRequest() method. Why? there was another example that did the same which had a authToken inside the XML yet the authToken was defined within the class constructor...

Any general advice on using the eBay PHP API would be greatly appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

无戏配角 2024-11-05 00:44:29

GetUser 将返回单个用户的用户数据。有一个很好的教程,请参阅下面的链接

http://developer.ebay.com/devzone/xml/docs/reference/ebay/getuser.html

GetUser Will returns the users data of single user .There is a good tutorial for this see below link

http://developer.ebay.com/devzone/xml/docs/reference/ebay/getuser.html

风流物 2024-11-05 00:44:29

你问了太多问题,以至于很难理解并回答所有问题。
我最好的建议是使用 eBay SDK for PHP。您可以在此处找到它。它将使您的生活变得更加轻松,并且它会按照您的意愿在变量中返回整个响应。

您将进行如下调用:

$service = new TradingServices\TradingService([
        'credentials' => [
            'devId' => 'YOUR_DEV_ID',
            'appId' => 'YOUR_APP_ID',
            'certId' => 'YOUR_CERT_ID',
        ],
        'siteId'    => YOUR_SITE_ID,
        'sandbox'   => false // or true,
        'token'     => YOUR_TOKEN
    ]);
$request = new TradingTypes\GetItemRequestType();
$request->ItemID = $your_itemid;
$response = $service->GetItem($request);

然后您在 $response var 中拥有您想要的所有数据,并且您可以通过使用获取特定数据

$title = $response->Item->Title;
$description = $response->Item->Description;
...

我已经使用此 SDK 开发了一个平台,我可以通过该平台管理3 个 eBay 商店中的 30k 个列表,我制作新列表,我监控所有 3 个商店的销售情况,我发送和接收来自所有 3 个商店的消息,等等。

它还提供了非常好的示例,这将使您更容易理解 eBay 文档。

所以请相信我,它是一个极其强大的工具,将使您的开发过程变得更加轻松,并帮助您更快地工作。

You ask so many questions that it's kind of hard to follow and answer all of them.
The best suggestion I have is to use the eBay SDK for PHP. You can find it here. It will make your life much, much easier, and it returns the entire response in a variable, just as you want.

You will make a call like this:

$service = new TradingServices\TradingService([
        'credentials' => [
            'devId' => 'YOUR_DEV_ID',
            'appId' => 'YOUR_APP_ID',
            'certId' => 'YOUR_CERT_ID',
        ],
        'siteId'    => YOUR_SITE_ID,
        'sandbox'   => false // or true,
        'token'     => YOUR_TOKEN
    ]);
$request = new TradingTypes\GetItemRequestType();
$request->ItemID = $your_itemid;
$response = $service->GetItem($request);

Then you have all the data you want in the $response var and you can get specific data by using

$title = $response->Item->Title;
$description = $response->Item->Description;
...

I have used this SDK to develop a platform from which I manage about 30k listings in 3 ebay shops, I make new listings, I monitor my sales in all the 3 shops, I send and receive the messages from all 3 shops, and so on.

It also has very good examples, and it will make it so much easier to understand the eBay documentation.

So trust me, it's and extremely powerful tool that will make your developing days much easier and will help you work so much faster.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文