jackhage/zanoxapi 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

jackhage/zanoxapi

Composer 安装命令:

composer require jackhage/zanoxapi

包简介

Zanox API with composer support

README 文档

README

A) Requirements

1) Zanox credentials

   a) Your connect ID
   b) Your secret key for secure API calls
   c) Your public key (optional)


2) Environment

   a) PHP 5

B) Setup

1) Copy all files into your server location, where the client should be used
2) Make sure all file permissions are set correctly

C) Usage

1) Include the API client base into your code

   <code>

        require_once '<your API client include dir>ApiClient.php';

   </code>


2) Instantiate a API client object

   The client can be invoked with three different protocols (XML, JSON SOAP)
   and two different version (2009-07-01, 2011-03-01). The
   default protocol is XML and the default version is 2011-03-01 if no
   parameter are given.

   Examples:

   a) Instantiate API client with default values

      <code>

          $api = ApiClient::factory();

      </code>


   b) Instantiate API client with JSON as protocol and default version 2011-03-01

      <code>

          $api = ApiClient::factory(PROTOCOL_JSON, VERSION_DEFAULT);

      </code>



3) Setup your credential information

   Setup

   <code>

       $connectId = '__your_connect_id__';
       $secretKey = '__your_secrect_key__';

       $api->setConnectId($connectId);
       $api->setSecretKey($secretKey);

  </code>



4) Make the API request

   Use the client object to make the client request to the Zanox API.

   a) API request for searchPrograms with XML as protocol

   <code>

       $xml = $api->searchPrograms();
       print_r($xml);

   </code>


   b) API request for searchPrograms with JSON as protocol

   <code>

       $json = $api->searchPrograms();
       print_r($json);

   </code>

D) Usage examples:

1) Get admedia

   <code>

        $api = ApiClient::factory(PROTOCOL_XML, VERSION_DEFAULT);

        $api->setConnectId($connectId);
        $api->setSecretKey($secretKey);

        $programId      = 738;
        $region         = NULL;
        $format         = 8;
        $partnerShip    = NULL;
        $purpose        = NULL;
        $admediumType   = 'image';
        $categoryId     = NULL;
        $adspaceId      = NULL;
        $page           = 0;
        $items          = 10;

        $xml = $api->getAdmedia ($programId, $region, $format, $partnerShip,
                        $purpose, $admediumType, $categoryId, $adspaceId,
                        $page, $items);
        print_r($xml);

   </code>


2) Search products

   <code>

        $api = ApiClient::factory(PROTOCOL_XML, VERSION_DEFAULT);

        $api->setConnectId($connectId);
        $api->setSecretKey($secretKey);

        $query      = "auto";
        $searchType = 'phrase';
        $programs   = array(660,10,20,30);
        $region     = NULL;
        $categoryId = NULL;
        $programId  = array();
        $hasImages  = true;
        $minPrice   = 0;
        $maxPrice   = NULL;
        $adspaceId  = NULL;
        $page       = 0;
        $items      = 10;

        $xml = $api->searchProducts($query, $searchType, $region,
                        $categoryId, $programId, $hasImages, $minPrice,
                        $maxPrice, $adspaceId, $page, $items);
        print_r($xml);

   </code>

统计信息

  • 总下载量: 24.45k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 24
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2014-05-05