Exemplo n.º 1
0
 function details($params = array())
 {
     if (!isset($params['user_id'])) {
         echo "User ID required";
         die;
     }
     $request = 'users/' . $params['user_id'];
     $request .= parent::createURL($params, array('user_id'));
     $result = parent::makeRequest($request);
     return $result;
 }
 function childCategories($params = array())
 {
     if (!isset($params['category'])) {
         echo "Tag required";
         die;
     }
     $request = 'categories/' . $params['category'] . '/children';
     $request .= parent::createURL($params, array('category'));
     $result = parent::makeRequest($request);
     return $result;
 }
Exemplo n.º 3
0
 function byName($params = array())
 {
     if (!isset($params['search_name'])) {
         echo "Username or partial username required";
         die;
     }
     $request = 'shops/keywords/' . $params['search_name'];
     $request .= parent::createURL($params, array('search_name'));
     $result = parent::makeRequest($request);
     return $result;
 }
Exemplo n.º 4
0
<?php

ini_set("display_errors", "1");
ERROR_REPORTING(E_ALL);
require_once 'etsy_api.php';
/*A set of options may be passed in with only one being required
 * REQUIRED = etsy_key
 * This is the api key given to you by etsy used to verify your account defaults to "null"
 *
 * Optional
 * base_url = may be set manually, defaults to v1
 * cache = turn caching on or off, defaults to false
 * ttl = ammount of time cache should last written in english (ie "+1 hour", "+1 day"); defaults to "+1 hour"
 * tmp_dir = directory to which your cache file can be written must be writable by the server; defaults to "/tmp/"
 */
$options = array('etsy_key' => 'your_key_here', 'cache' => true, 'tmp_dir' => 'tmp', 'ttl' => "+1 minute");
$etsy = new Etsy($options);
/* building an etsy request is easy just supply four things
 * - section of etsy name (ie: users, listings, shops, etc...)
 * - function you would like to call, tried to hold naming convention by using the  method name
 *     without the "getName" part at the beginning. (ie: getUsersByName = byName)
 * - array of options, these are the options available in the etsy method, exactly as they are written there
 * - json true/false, whether you would like a json string(true) or a php json obj (false)
 */
$test = $etsy->request('listings', 'allListings', array('limit' => 5), false);
var_dump($test);
Exemplo n.º 5
0
function getEtsyListings()
{
    $item = new Etsy();
    $listings = $item->getListings();
    return $listings;
}
Exemplo n.º 6
0
 function byTags($params = array())
 {
     if (!isset($params['tags'])) {
         echo "Tags required";
         die;
     }
     $request = 'listings/tags/' . $params['tags'];
     $request .= parent::createURL($params, array('tags'));
     $result = parent::makeRequest($request);
     return $result;
 }