Skip to content

Instantly share code, notes, and snippets.

@davidtsadler
davidtsadler / md2k.sh
Last active May 3, 2024 16:20
Very simple script to that uses pandoc to convert a markdown file into a .mobi file that can be read on a Kindle.
#!/usr/bin/env bash
MD=$1
EPUB="${MD%.*}.epub"
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <file name>."
exit 1
fi
@davidtsadler
davidtsadler / puppify.sh
Last active June 28, 2018 15:31
Bash script to install puppet on Ubuntu 16.04. Puppet can then be used to provision the machine.
#!/bin/bash
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root." >&2
exit 1
fi
PROVISION_REPO=$1
BRANCH=$2
if [ "$#" -ne 2 ]; then
<?php
class StdClassLike implements JmesPathableObjectInterface
{
private $values = [];
public function __get($name)
{
return $this->values[$name];
}
<?php
class ArrayLike implements JmesPathableArrayInterface
{
private $data = [];
private $position = 0;
public function __construct(array $data = [])
{

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 / shopping_get_item.php
Created June 8, 2016 13:29
Getting an item by calling GetSingleItem in the Shopping 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\Shopping\Services;
use \DTS\eBaySDK\Shopping\Types;
use \DTS\eBaySDK\Shopping\Enums;
$service = new Services\ShoppingService([
'credentials' => [
@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' => [
@davidtsadler
davidtsadler / trading_get_item.php
Last active June 1, 2017 10:44
Getting an item by calling GetItem in the Trading 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\Trading\Services;
use \DTS\eBaySDK\Trading\Types;
use \DTS\eBaySDK\Trading\Enums;
$service = new Services\TradingService([
'authToken' => 'your-auth-token',
<?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>
<?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',