iT邦幫忙

DAY 26
1

[老鷹之且戰且飛]系列 第 26

[老鷹之且戰且飛]總結一下ebay api

老鷹利用官方提供的開發包,

接下來就是套上公式,很方便的!!

接下來就是看文件放XML就好了~~!

<?php
//導入
require_once('keys.php');
require_once('eBaySession.php');

//SiteID must also be set in the Request's XML
//SiteID = 0  (US) - UK = 3, Canada = 2, Australia = 15, ....
//SiteID Indicates the eBay site to associate the call with
//選擇站別
$siteID = 0;

//the call being made:

//選擇呼叫
$verb = 'GetUserDisputes';
//放入xml
$requestXmlBody = <<<XML
<?xml version="1.0" encoding="utf-8"?>
<GetUserDisputesRequest xmlns="urn:ebay:apis:eBLBaseComponents">
  <RequesterCredentials>
    <eBayAuthToken>$userToken</eBayAuthToken>
  </RequesterCredentials>
  <WarningLevel>High</WarningLevel>
  <DisputeFilterType>AllInvolvedDisputes</DisputeFilterType>
  <DisputeSortType>DisputeCreatedTimeDescending</DisputeSortType>
  <Pagination>
    <EntriesPerPage>5</EntriesPerPage>
    <PageNumber>1</PageNumber>
  </Pagination>
</GetUserDisputesRequest>
XML;

/****************************以下不用動******************************************/
$session = new eBaySession($userToken, $devID, $appID, $certID, $serverUrl, $compatabilityLevel, $siteID, $verb);

//send the request and get response
$responseXml = $session->sendHttpRequest($requestXmlBody);
if (stristr($responseXml, 'HTTP 404') || $responseXml == ''):
    die('<P>Error sending request');
endif;

/****************************以上不用動*****************************************/
$xml = simplexml_load_string($responseXml);

$json = json_encode($xml);

$array = json_decode($json, TRUE);

print_r($array);

/***************************已上處理*****************************************/

上一篇
[老鷹之且戰且飛]Ebay API for PHP 7
下一篇
[老鷹之且戰且飛]後續實例1(GetOrders)
系列文
[老鷹之且戰且飛]30

尚未有邦友留言

立即登入留言