The Artima Developer Community
Sponsored Link

PHP Buzz Forum
25 First public release of Services_Ebay 13

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Stephan Schmidt

Posts: 238
Nickname: schst
Registered: Sep, 2004

Stephan Schmidt is a founding member of PHP Application Tools and a PEAR developer.
25 First public release of Services_Ebay 13 Posted: Oct 30, 2004 9:40 AM
Reply to this message Reply

This post originated from an RSS feed registered with PHP Buzz by Stephan Schmidt.
Original Post: 25 First public release of Services_Ebay 13
Feed Title: a programmer's best friend
Feed URL: http://blog.php-tools.net/rss.php?version=1.0
Feed Description: The blog of PHP Application Tools
Latest PHP Buzz Posts
Latest PHP Buzz Posts by Stephan Schmidt
Latest Posts From a programmer's best friend

Advertisement
12d4 Today, I released the first public version of the PHP5-package Services_Ebay, which provides a very easy way to access the eBay XML API with PHP5.
Although the package is still in devel state, it supports about 50 of the 70 API calls that the eBay web service offers. Furthermore it adds model classes for eBay users, items, feedback, categories, etc. that helps you working with the eBay data. By making use of PHP5's new OO-features, you may access properties of eBay items as if they were native PHP data structures. The easiest way to demonstrate this, is a tiny example. The following code snippet fetches an eBay item:
<?php
require_once 'Services/Ebay.php';

$session = Services_Ebay::getSession($devId, $appId, $certId);
$session->setToken($token);
$ebay = new Services_Ebay($session);

$item = $ebay->GetItem(4501333179);

echo 'User-Id of the seller: '.$item->Seller->UserId;
print_r($item->toArray());
?>

If you are the seller of the item, you may revise the item and send it back to eBay using the following code:
<?php
$item->Title = 'The new item title';
$item->ReviseItem();
?>

Working with other entities, like users or categories, is also extremely easy:
<?php
$supes = $ebay->GetUser('superman-74');
$feedback = $supes->getFeedback( Services_Ebay::FEEDBACK_VERBOSE, 1, 10 );
foreach ($feedback as $entry) {
echo 'Feedback for '.$feedback->ItemNumber."\n";
echo $feedback;
echo "\n";
}
?>

All models provide are using methods like __call(), __get() and __toString() so they can be used in several ways.

The Services_Ebay class is loading the API calls on demand and thus reduces the code that needs to be parsed. Each API call may be used in three ways:
  1. Use it with the Services_Ebay class and pass arguments like you would pass them to a standard PHP function (you need to pass only the most important parameters).
  2. Use it with the Servcies_Ebay class and pass arguments as an associative array (needed, when sending complex queries)
  3. Instantiate the object on its own, pass arguments to the constructor.
Furthermore, the API calls are able to describe their parameter list by calling $call->describeCall();

To use the package, you will need to register as an eBay developer at http://developer.ebay.com and then create an authentication token from the token generation tool at the developer site.

More information about Services_Ebay and the eBay XML API can be found in the PEAR proposal and the eBay developer site. 26

Read: 25 First public release of Services_Ebay 13

Topic: Guru Speak Previous Topic   Next Topic Topic: Comparing Tapestry to CEP

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use