-
Notifications
You must be signed in to change notification settings - Fork 0
/
finding.php
89 lines (78 loc) · 3.81 KB
/
finding.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<?php
namespace macropage\ebaysdk\finding;
use macropage\ebaysdk\base\base;
use macropage\ebaysdk\base\soap_client_finding;
use macropage\ebaysdk\finding\ClassMap as ClassMapfindingService;
use macropage\ebaysdk\finding\ServiceType as EbayfindingSerice;
use WsdlToPhp\PackageBase\AbstractSoapClientBase as SoapClientBase;
/**
* Class findingservice
* @package macropage\sdk_ebay_soap
*
* @method getSearchKeywordsRecommendation(\macropage\ebaysdk\finding\StructType\GetSearchKeywordsRecommendationRequest $messageParameters)
* @method findItemsByKeywords(\macropage\ebaysdk\finding\StructType\FindItemsByKeywordsRequest $messageParameters)
* @method findItemsByCategory(\macropage\ebaysdk\finding\StructType\FindItemsByCategoryRequest $messageParameters)
* @method findItemsAdvanced(\macropage\ebaysdk\finding\StructType\FindItemsAdvancedRequest $messageParameters)
* @method findItemsByProduct(\macropage\ebaysdk\finding\StructType\FindItemsByProductRequest $messageParameters)
* @method findItemsIneBayStores(\macropage\ebaysdk\finding\StructType\FindItemsIneBayStoresRequest $messageParameters)
* @method findItemsByImage(\macropage\ebaysdk\finding\StructType\FindItemsByImageRequest $messageParameters)
* @method getHistograms(\macropage\ebaysdk\finding\StructType\GetHistogramsRequest $messageParameters)
* @method findCompletedItems(\macropage\ebaysdk\finding\StructType\FindCompletedItemsRequest $messageParameters)
* @method getVersion(\macropage\ebaysdk\finding\StructType\GetVersionRequest $messageParameters)
* @method findItemsForFavoriteSearch(\macropage\ebaysdk\finding\StructType\FindItemsForFavoriteSearchRequest $messageParameters)
*
*/
class finding extends base {
/**
* @var array
*/
private $SoapServicoptions;
private $api_endpoints = [
'live' => 'https://svcs.ebay.com/services/search/FindingService/v1',
'sandbox' => 'https://svcs.sandbox.ebay.com/services/search/FindingService/v1'
];
public function __construct(array $wsdlOptions = [], $api_endpoint = 'live') {
$this->SoapServicoptions = [
SoapClientBase::WSDL_URL => __DIR__ . DIRECTORY_SEPARATOR . 'wsdl' . DIRECTORY_SEPARATOR . 'finding.wsdl',
SoapClientBase::WSDL_CLASSMAP => ClassMapfindingService::get(),
SoapClientBase::WSDL_TRACE => true,
SoapClientBase::WSDL_CACHE_WSDL => WSDL_CACHE_BOTH,
SoapClientBase::WSDL_CONNECTION_TIMEOUT => 180,
SoapClientBase::WSDL_COMPRESSION => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | SOAP_COMPRESSION_DEFLATE,
SoapClientBase::WSDL_STREAM_CONTEXT => stream_context_create([
'ssl' => [
'verify_peer' => false,
'verify_host' => false,
'allow_self_signed' => true,
]
])
];
$wsdlOptions = $this->overrideSoapWsdlOptions($this->SoapServicoptions, $wsdlOptions);
$this->Service = new EbayfindingSerice\Service($wsdlOptions);
$SpecialSoapClientForFinding = new soap_client_finding($this->SoapServicoptions['wsdl_url'], $wsdlOptions);
$this->Service->setSoapClient($SpecialSoapClientForFinding);
if (array_key_exists($api_endpoint, $this->api_endpoints)) {
$this->api_endpoint = $this->api_endpoints[$api_endpoint];
} else {
throw new \RuntimeException('unknown endpoint: ' . $api_endpoint . ' available: ' . implode(',', array_keys($this->api_endpoints)));
}
}
public function __call($name, $arguments) {
return $this->call($name, $arguments);
}
/**
* @param $appid
* @param $devid
* @param $authtoken
*/
public function setCredentials($appid) {
$this->appid = $appid;
$this->Service->setHttpHeader('X-EBAY-SOA-SECURITY-APPNAME', $appid);
}
/**
* @param mixed $api_endpoint
*/
public function setApiEndpoint($api_endpoint) {
$this->api_endpoint = $api_endpoint;
}
}