Skip to content

Instantly share code, notes, and snippets.

@davidtsadler
davidtsadler / check_requirements.php
Last active December 10, 2015 07:08
Example requirements checker for using Bigcommerce PHP client found at https://github.com/bigcommerce/bigcommerce-api-php It can be executed via the command line or uploaded to a web server.
<?php
$fail = array();
$pass = array();
if (version_compare(phpversion(), '5.2.4', '<')) {
$fail[] = 'You need PHP 5.2.4 or greater';
}
else {
$pass[] = 'You have PHP 5.2.4 or greater';
<?php
require __DIR__.'/vendor/autoload.php';
use \DTS\eBaySDK\Constants;
use \DTS\eBaySDK\Trading\Services;
use \DTS\eBaySDK\Trading\Types;
use \DTS\eBaySDK\Trading\Enums;
$service = new Services\TradingService(array(
'apiVersion' => '941',
<?php
require __DIR__.'/vendor/autoload.php';
use \DTS\eBaySDK\Constants;
use \DTS\eBaySDK\Trading\Services;
use \DTS\eBaySDK\Trading\Types;
use \DTS\eBaySDK\Trading\Enums;
$service = new Services\TradingService(array(
'apiVersion' => '941',
<?php
require __DIR__.'/vendor/autoload.php';
use \DTS\eBaySDK\Constants;
use \DTS\eBaySDK\Trading\Services;
use \DTS\eBaySDK\Trading\Types;
use \DTS\eBaySDK\Trading\Enums;
$service = new Services\TradingService(array(
'apiVersion' => '941',
<?php
require __DIR__.'/vendor/autoload.php';
use \DTS\eBaySDK\Constants;
use \DTS\eBaySDK\Trading\Services;
use \DTS\eBaySDK\Trading\Types;
use \DTS\eBaySDK\Trading\Enums;
$service = new Services\TradingService(array(
'apiVersion' => '941',
<?xml version="1.0" encoding="UTF-8"?>
<BulkDataExchangeRequests xmlns="urn:ebay:apis:eBLBaseComponents">
<Header xmlns="urn:ebay:apis:eBLBaseComponents">
<SiteID>77</SiteID>
<Version>955</Version>
</Header>
<ReviseInventoryStatusRequest xmlns="urn:ebay:apis:eBLBaseComponents">
<ErrorLanguage>en_US</ErrorLanguage>
<Version>955</Version>
<WarningLevel>High</WarningLevel>
@davidtsadler
davidtsadler / finding_get_item.php
Created June 8, 2016 13:26
Getting an item by calling findItemsAdvanced in the Finding API using the [eBay SDK for PHP](https://github.com/davidtsadler/ebay-sdk-php)
<?php
require __DIR__.'/vendor/autoload.php';
use \DTS\eBaySDK\Constants;
use \DTS\eBaySDK\Finding\Services;
use \DTS\eBaySDK\Finding\Types;
use \DTS\eBaySDK\Finding\Enums;
$service = new Services\FindingService([
'credentials' => [

If you are comfortable with using Composer then I have developed an SDK for PHP that you can install. It simplifies the development of projects by removing the need for you to deal with XML and HTTP requests. The SDK enables you to construct requests and handle responses in an OOP way.

Below are three examples of how to get an item using the Trading, Finding, and Shopping services. Note that each service has it's own pros and cons. For example: The Trading service will probably return the most information about an item but it does require an auth token in order to use it. Where as the Shopping service does not require an auth token but less information may be returned. Which service you use will depend on your project requirements.

To get the most out of using the SDK I would suggest that you first read the getting started guide for a quick overview. Then read the eBay documentation for each of the operations that are used in the examples below. You should be able to see how the SDK is used to construct the

@davidtsadler
davidtsadler / get_ebay_details.php
Created August 15, 2014 11:51
GeteBayDetails example.
<?php
require __DIR__.'/vendor/autoload.php';
use \DTS\eBaySDK\Constants;
use \DTS\eBaySDK\Trading\Services;
use \DTS\eBaySDK\Trading\Types;
$sites = array(
array('id' => Constants\SiteIds::US, 'name' => 'United States'),
array('id' => Constants\SiteIds::ENCA, 'name' => 'Canada (English)'),
<?php
class StdClassLike implements JmesPathableObjectInterface
{
private $values = [];
public function __get($name)
{
return $this->values[$name];
}