| 1 |
lars |
1 |
<?php
|
|
|
2 |
// $Id: EbatNs_Session.php,v 1.4 2008-06-09 10:29:36 michael Exp $
|
|
|
3 |
// $Log: EbatNs_Session.php,v $
|
|
|
4 |
// Revision 1.4 2008-06-09 10:29:36 michael
|
|
|
5 |
// *** empty log message ***
|
|
|
6 |
//
|
|
|
7 |
// Revision 1.3 2008/05/04 15:24:03 carsten
|
|
|
8 |
// *** empty log message ***
|
|
|
9 |
//
|
|
|
10 |
// Revision 1.2 2008/05/02 15:04:05 carsten
|
|
|
11 |
// Initial, PHP5
|
|
|
12 |
//
|
|
|
13 |
//
|
|
|
14 |
require_once 'EbatNs_Defines.php';
|
|
|
15 |
|
|
|
16 |
class EbatNs_Session {
|
|
|
17 |
// this array holds all attribute data of the object
|
|
|
18 |
protected $_props = array();
|
|
|
19 |
/**
|
|
|
20 |
* sets a property by name and value
|
|
|
21 |
*/
|
|
|
22 |
function _setProp($key, $value)
|
|
|
23 |
{
|
|
|
24 |
$this->_props[$key] = $value;
|
|
|
25 |
}
|
|
|
26 |
/**
|
|
|
27 |
* gets a property by name
|
|
|
28 |
*/
|
|
|
29 |
function _getProp($key)
|
|
|
30 |
{
|
|
|
31 |
return $this->_props[$key];
|
|
|
32 |
}
|
|
|
33 |
/**
|
|
|
34 |
* Read accessor of AppId.
|
|
|
35 |
* The value of this property is used as the application ID in each XML request sent to the eBay API.
|
|
|
36 |
*
|
|
|
37 |
* @access public
|
|
|
38 |
* @return string Value of the AppId property
|
|
|
39 |
*/
|
|
|
40 |
function getAppId()
|
|
|
41 |
{
|
|
|
42 |
return $this->_props['AppId'];
|
|
|
43 |
}
|
|
|
44 |
/**
|
|
|
45 |
* Write accessor of AppId.
|
|
|
46 |
* The value of this property is used as the application ID in each XML request sent to the eBay API.
|
|
|
47 |
*
|
|
|
48 |
* @access public
|
|
|
49 |
* @param string $value The new value for the AppId property
|
|
|
50 |
* @return void
|
|
|
51 |
*/
|
|
|
52 |
function setAppId($value)
|
|
|
53 |
{
|
|
|
54 |
$this->_props['AppId'] = $value;
|
|
|
55 |
}
|
|
|
56 |
/**
|
|
|
57 |
* Read accessor of DevId.
|
|
|
58 |
* The value of this property is used as the developer ID in each XML request sent to the eBay API.
|
|
|
59 |
*
|
|
|
60 |
* @access public
|
|
|
61 |
* @return string Value of the DevId property
|
|
|
62 |
*/
|
|
|
63 |
function getDevId()
|
|
|
64 |
{
|
|
|
65 |
return $this->_props['DevId'];
|
|
|
66 |
}
|
|
|
67 |
/**
|
|
|
68 |
* Write accessor of DevId.
|
|
|
69 |
* The value of this property is used as the developer ID in each XML request sent to the eBay API.
|
|
|
70 |
*
|
|
|
71 |
* @access public
|
|
|
72 |
* @param string $value The new value for the DevId property
|
|
|
73 |
* @return void
|
|
|
74 |
*/
|
|
|
75 |
function setDevId($value)
|
|
|
76 |
{
|
|
|
77 |
$this->_props['DevId'] = $value;
|
|
|
78 |
}
|
|
|
79 |
/**
|
|
|
80 |
* Read accessor of CertId.
|
|
|
81 |
* The value of this property is used as the security certificate in each XML request sent to the eBay API.
|
|
|
82 |
*
|
|
|
83 |
* @access public
|
|
|
84 |
* @return string Value of the CertId property
|
|
|
85 |
*/
|
|
|
86 |
function getCertId()
|
|
|
87 |
{
|
|
|
88 |
return $this->_props['CertId'];
|
|
|
89 |
}
|
|
|
90 |
/**
|
|
|
91 |
* Write accessor of CertId.
|
|
|
92 |
* The value of this property is used as the security certificate in each XML request sent to the eBay API.
|
|
|
93 |
*
|
|
|
94 |
* @access public
|
|
|
95 |
* @param string $value The new value for the CertId property
|
|
|
96 |
* @return void
|
|
|
97 |
*/
|
|
|
98 |
function setCertId($value)
|
|
|
99 |
{
|
|
|
100 |
$this->_props['CertId'] = $value;
|
|
|
101 |
}
|
|
|
102 |
/**
|
|
|
103 |
* Read accessor of RequestPassword.
|
|
|
104 |
* Specifies the password for the user making the API call. This value is sent in the <RequestPassword> element.
|
|
|
105 |
*
|
|
|
106 |
* @access public
|
|
|
107 |
* @return string Value of the RequestPassword property
|
|
|
108 |
*/
|
|
|
109 |
function getRequestPassword()
|
|
|
110 |
{
|
|
|
111 |
return $this->_props['RequestPassword'];
|
|
|
112 |
}
|
|
|
113 |
/**
|
|
|
114 |
* Write accessor of RequestPassword.
|
|
|
115 |
* Specifies the password for the user making the API call. This value is sent in the <RequestPassword> element.
|
|
|
116 |
*
|
|
|
117 |
* @access public
|
|
|
118 |
* @param string $value The new value for the RequestPassword property
|
|
|
119 |
* @return void
|
|
|
120 |
*/
|
|
|
121 |
function setRequestPassword($value)
|
|
|
122 |
{
|
|
|
123 |
$this->_props['RequestPassword'] = $value;
|
|
|
124 |
}
|
|
|
125 |
/**
|
|
|
126 |
* Read accessor of RequestUser.
|
|
|
127 |
* Specifies the user ID making the API call. This value is sent in the <RequestUserId> element.
|
|
|
128 |
*
|
|
|
129 |
* @access public
|
|
|
130 |
* @return string Value of the RequestUser property
|
|
|
131 |
*/
|
|
|
132 |
function getRequestUser()
|
|
|
133 |
{
|
|
|
134 |
return $this->_props['RequestUser'];
|
|
|
135 |
}
|
|
|
136 |
/**
|
|
|
137 |
* Write accessor of RequestUser.
|
|
|
138 |
* Specifies the user ID making the API call. This value is sent in the <RequestUserId> element.
|
|
|
139 |
*
|
|
|
140 |
* @access public
|
|
|
141 |
* @param string $value The new value for the RequestUser property
|
|
|
142 |
* @return void
|
|
|
143 |
*/
|
|
|
144 |
function setRequestUser($value)
|
|
|
145 |
{
|
|
|
146 |
$this->_props['RequestUser'] = $value;
|
|
|
147 |
}
|
|
|
148 |
/**
|
|
|
149 |
* Read accessor of TimeOffset.
|
|
|
150 |
* Time offset of the local machine from eBay official time. Whenever using Timestamps on any calls (in and out) the information will be adapted with this value.
|
|
|
151 |
* Please provide a string with relative information e.g. "+0200" for a timezone which is 2 hours infront of GMT
|
|
|
152 |
*
|
|
|
153 |
* @access public
|
|
|
154 |
* @return string Value of the TimeOffset property
|
|
|
155 |
*/
|
|
|
156 |
function getTimeOffset()
|
|
|
157 |
{
|
|
|
158 |
return $this->_props['TimeOffset'];
|
|
|
159 |
}
|
|
|
160 |
/**
|
|
|
161 |
* Write accessor of TimeOffset.
|
|
|
162 |
* Time offset of the local machine from eBay official time. Whenever using Timestamps on any calls (in and out) the information will be adapted with this value.
|
|
|
163 |
* Please provide a string with relative information e.g. "+0200" for a timezone which is 2 hours infront of GMT
|
|
|
164 |
*
|
|
|
165 |
* @access public
|
|
|
166 |
* @param string $value The new value for the TimeOffset property
|
|
|
167 |
* @return void
|
|
|
168 |
*/
|
|
|
169 |
function setTimeOffset($value)
|
|
|
170 |
{
|
|
|
171 |
$this->_props['TimeOffset'] = $value;
|
|
|
172 |
}
|
|
|
173 |
/**
|
|
|
174 |
* Read accessor of LogLevel.
|
|
|
175 |
* Define the amount og information being logged to the LogFile. Use one of the following defines (or an AND combined value) :
|
|
|
176 |
*
|
|
|
177 |
* @access public
|
|
|
178 |
* @return number Value of the LogLevel property
|
|
|
179 |
*/
|
|
|
180 |
function getLogLevel()
|
|
|
181 |
{
|
|
|
182 |
return $this->_props['LogLevel'];
|
|
|
183 |
}
|
|
|
184 |
/**
|
|
|
185 |
* Write accessor of LogLevel.
|
|
|
186 |
* Define the amount og information being logged to the LogFile. Use one of the following defines (or an AND combined value) :
|
|
|
187 |
*
|
|
|
188 |
* @access public
|
|
|
189 |
* @param number $value The new value for the LogLevel property
|
|
|
190 |
* @return void
|
|
|
191 |
*/
|
|
|
192 |
function setLogLevel($value)
|
|
|
193 |
{
|
|
|
194 |
$this->_props['LogLevel'] = $value;
|
|
|
195 |
}
|
|
|
196 |
/**
|
|
|
197 |
* Read accessor of LogFilename.
|
|
|
198 |
* Filename of the log-file. If the log-fle does not exits it will be created otherwise data gets appended. Be sure of setting write-permission to the user the php process is running as (aka www).
|
|
|
199 |
* Should install a mechanism to delete or roll the file once a time to not screw up your system.
|
|
|
200 |
*
|
|
|
201 |
* @access public
|
|
|
202 |
* @return string Value of the LogFilename property
|
|
|
203 |
*/
|
|
|
204 |
function getLogFilename()
|
|
|
205 |
{
|
|
|
206 |
return $this->_props['LogFilename'];
|
|
|
207 |
}
|
|
|
208 |
/**
|
|
|
209 |
* Write accessor of LogFilename.
|
|
|
210 |
* Filename of the log-file. If the log-fle does not exits it will be created otherwise data gets appended. Be sure of setting write-permission to the user the php process is running as (aka www).
|
|
|
211 |
* Should install a mechanism to delete or roll the file once a time to not screw up your system.
|
|
|
212 |
*
|
|
|
213 |
* @access public
|
|
|
214 |
* @param string $value The new value for the LogFilename property
|
|
|
215 |
* @return void
|
|
|
216 |
*/
|
|
|
217 |
function setLogFilename($value)
|
|
|
218 |
{
|
|
|
219 |
$this->_props['LogFilename'] = $value;
|
|
|
220 |
}
|
|
|
221 |
/**
|
|
|
222 |
* Read accessor of LogMode.
|
|
|
223 |
* defines how to log, actually same as define in build-in error_log function :
|
|
|
224 |
* 0 log to syslog (or event log on winnt)
|
|
|
225 |
* 1 email (set in LogFileName)
|
|
|
226 |
* 2 debugger port (set in LogFileName)
|
|
|
227 |
* 3 file (set in LogFileName)
|
|
|
228 |
*
|
|
|
229 |
* @access public
|
|
|
230 |
* @return number Value of the LogMode property
|
|
|
231 |
*/
|
|
|
232 |
function getLogMode()
|
|
|
233 |
{
|
|
|
234 |
return $this->_props['LogMode'];
|
|
|
235 |
}
|
|
|
236 |
/**
|
|
|
237 |
* Write accessor of LogMode.
|
|
|
238 |
* defines how to log, actually same as define in build-in error_log function :
|
|
|
239 |
* 0 log to syslog (or event log on winnt)
|
|
|
240 |
* 1 email (set in LogFileName)
|
|
|
241 |
* 2 debugger port (set in LogFileName)
|
|
|
242 |
* 3 file (set in LogFileName)
|
|
|
243 |
*
|
|
|
244 |
* @access public
|
|
|
245 |
* @param number $value The new value for the LogMode property
|
|
|
246 |
* @return void
|
|
|
247 |
*/
|
|
|
248 |
function setLogMode($value)
|
|
|
249 |
{
|
|
|
250 |
$this->_props['LogMode'] = $value;
|
|
|
251 |
}
|
|
|
252 |
/**
|
|
|
253 |
* Read accessor of ApiMode.
|
|
|
254 |
* Defines how data is accessed. Mainly switch between direct and integration access through a local datastorage. Use one of the following:
|
|
|
255 |
* EBAY_CALLMODE_DIRECT = 0
|
|
|
256 |
* EBAY_CALLMODE_INTEGRATION = 1
|
|
|
257 |
*
|
|
|
258 |
* @access public
|
|
|
259 |
* @return define Value of the ApiMode property
|
|
|
260 |
*/
|
|
|
261 |
function getApiMode()
|
|
|
262 |
{
|
|
|
263 |
return $this->_props['ApiMode'];
|
|
|
264 |
}
|
|
|
265 |
/**
|
|
|
266 |
* Write accessor of ApiMode.
|
|
|
267 |
* Defines how data is accessed. Mainly switch between direct and integration access through a local datastorage. Use one of the following:
|
|
|
268 |
* EBAY_CALLMODE_DIRECT = 0
|
|
|
269 |
* EBAY_CALLMODE_INTEGRATION = 1
|
|
|
270 |
*
|
|
|
271 |
* @access public
|
|
|
272 |
* @param define $value The new value for the ApiMode property
|
|
|
273 |
* @return void
|
|
|
274 |
*/
|
|
|
275 |
function setApiMode($value)
|
|
|
276 |
{
|
|
|
277 |
$this->_props['ApiMode'] = $value;
|
|
|
278 |
}
|
|
|
279 |
/**
|
|
|
280 |
* Read accessor of SiteId.
|
|
|
281 |
* Defines the eBay Site from or to data will be sent. Use a numeric value or one of the following defines :
|
|
|
282 |
* EBAY_SITE_GERMANY
|
|
|
283 |
* EBAY_SITE_US
|
|
|
284 |
* EBAY_SITE_ ...
|
|
|
285 |
*
|
|
|
286 |
* @access public
|
|
|
287 |
* @return number Value of the SiteId property
|
|
|
288 |
*/
|
|
|
289 |
function getSiteId()
|
|
|
290 |
{
|
|
|
291 |
return $this->_props['SiteId'];
|
|
|
292 |
}
|
|
|
293 |
/**
|
|
|
294 |
* Write accessor of SiteId.
|
|
|
295 |
* Defines the eBay Site from or to data will be sent. Use a numeric value or one of the following defines :
|
|
|
296 |
* EBAY_SITE_GERMANY
|
|
|
297 |
* EBAY_SITE_US
|
|
|
298 |
* EBAY_SITE_ ...
|
|
|
299 |
*
|
|
|
300 |
* @access public
|
|
|
301 |
* @param number $value The new value for the SiteId property
|
|
|
302 |
* @return void
|
|
|
303 |
*/
|
|
|
304 |
function setSiteId($value)
|
|
|
305 |
{
|
|
|
306 |
$this->_props['SiteId'] = $value;
|
|
|
307 |
}
|
|
|
308 |
/**
|
|
|
309 |
* Read accessor of CompatibilityLevel.
|
|
|
310 |
*
|
|
|
311 |
* @access public
|
|
|
312 |
* @return string Value of the CompatibilityLevel property
|
|
|
313 |
*/
|
|
|
314 |
function getCompatibilityLevel()
|
|
|
315 |
{
|
|
|
316 |
return $this->_props['CompatibilityLevel'];
|
|
|
317 |
}
|
|
|
318 |
/**
|
|
|
319 |
* Write accessor of CompatibilityLevel.
|
|
|
320 |
*
|
|
|
321 |
* @access public
|
|
|
322 |
* @param string $value The new value for the CompatibilityLevel property
|
|
|
323 |
* @return void
|
|
|
324 |
*/
|
|
|
325 |
function setCompatibilityLevel($value)
|
|
|
326 |
{
|
|
|
327 |
$this->_props['CompatibilityLevel'] = $value;
|
|
|
328 |
}
|
|
|
329 |
/**
|
|
|
330 |
* Read accessor of ErrorLevel.
|
|
|
331 |
*
|
|
|
332 |
* @access public
|
|
|
333 |
* @return number Value of the ErrorLevel property
|
|
|
334 |
*/
|
|
|
335 |
function getErrorLevel()
|
|
|
336 |
{
|
|
|
337 |
return $this->_props['ErrorLevel'];
|
|
|
338 |
}
|
|
|
339 |
/**
|
|
|
340 |
* Write accessor of ErrorLevel.
|
|
|
341 |
*
|
|
|
342 |
* @access public
|
|
|
343 |
* @param number $value The new value for the ErrorLevel property
|
|
|
344 |
* @return void
|
|
|
345 |
*/
|
|
|
346 |
function setErrorLevel($value)
|
|
|
347 |
{
|
|
|
348 |
$this->_props['ErrorLevel'] = $value;
|
|
|
349 |
}
|
|
|
350 |
/**
|
|
|
351 |
* Read accessor of ErrorLanguage.
|
|
|
352 |
*
|
|
|
353 |
* @access public
|
|
|
354 |
* @return number Value of the ErrorLanguage property
|
|
|
355 |
*/
|
|
|
356 |
function getErrorLanguage()
|
|
|
357 |
{
|
|
|
358 |
return $this->_props['ErrorLanguage'];
|
|
|
359 |
}
|
|
|
360 |
/**
|
|
|
361 |
* Write accessor of ErrorLanguage.
|
|
|
362 |
*
|
|
|
363 |
* @access public
|
|
|
364 |
* @param number $value The new value for the ErrorLanguage property
|
|
|
365 |
* @return void
|
|
|
366 |
*/
|
|
|
367 |
function setErrorLanguage($value)
|
|
|
368 |
{
|
|
|
369 |
$this->_props['ErrorLanguage'] = $value;
|
|
|
370 |
}
|
|
|
371 |
/**
|
|
|
372 |
* Read accessor of RequestTimeout.
|
|
|
373 |
*
|
|
|
374 |
* @access public
|
|
|
375 |
* @return number Value of the RequestTimeout property
|
|
|
376 |
*/
|
|
|
377 |
function getRequestTimeout()
|
|
|
378 |
{
|
|
|
379 |
return $this->_props['RequestTimeout'];
|
|
|
380 |
}
|
|
|
381 |
/**
|
|
|
382 |
* Write accessor of RequestTimeout.
|
|
|
383 |
*
|
|
|
384 |
* @access public
|
|
|
385 |
* @param number $value The new value for the RequestTimeout property
|
|
|
386 |
* @return void
|
|
|
387 |
*/
|
|
|
388 |
function setRequestTimeout($value)
|
|
|
389 |
{
|
|
|
390 |
$this->_props['RequestTimeout'] = $value;
|
|
|
391 |
}
|
|
|
392 |
/**
|
|
|
393 |
* Read accessor of TokenMode.
|
|
|
394 |
*
|
|
|
395 |
* @access public
|
|
|
396 |
* @return boolean Value of the TokenMode property
|
|
|
397 |
*/
|
|
|
398 |
function getTokenMode()
|
|
|
399 |
{
|
|
|
400 |
return $this->_props['TokenMode'];
|
|
|
401 |
}
|
|
|
402 |
/**
|
|
|
403 |
* Write accessor of TokenMode.
|
|
|
404 |
*
|
|
|
405 |
* @access public
|
|
|
406 |
* @param boolean $value The new value for the TokenMode property
|
|
|
407 |
* @return void
|
|
|
408 |
*/
|
|
|
409 |
function setTokenMode($value)
|
|
|
410 |
{
|
|
|
411 |
$this->_props['TokenMode'] = $value;
|
|
|
412 |
}
|
|
|
413 |
/**
|
|
|
414 |
* Read accessor of TokenPickupFile.
|
|
|
415 |
* will be used to pickup / store the token information for this session
|
|
|
416 |
*
|
|
|
417 |
* @access public
|
|
|
418 |
* @return string Value of the TokenPickupFile property
|
|
|
419 |
*/
|
|
|
420 |
function getTokenPickupFile()
|
|
|
421 |
{
|
|
|
422 |
return $this->_props['TokenPickupFile'];
|
|
|
423 |
}
|
|
|
424 |
/**
|
|
|
425 |
* Write accessor of TokenPickupFile.
|
|
|
426 |
* will be used to pickup / store the token information for this session
|
|
|
427 |
*
|
|
|
428 |
* @access public
|
|
|
429 |
* @param string $value The new value for the TokenPickupFile property
|
|
|
430 |
* @return void
|
|
|
431 |
*/
|
|
|
432 |
function setTokenPickupFile($value)
|
|
|
433 |
{
|
|
|
434 |
$this->_props['TokenPickupFile'] = $value;
|
|
|
435 |
}
|
|
|
436 |
/**
|
|
|
437 |
* Read accessor of TokenUsePickupFile.
|
|
|
438 |
*
|
|
|
439 |
* @access public
|
|
|
440 |
* @return boolean Value of the TokenUsePickupFile property
|
|
|
441 |
*/
|
|
|
442 |
function getTokenUsePickupFile()
|
|
|
443 |
{
|
|
|
444 |
return $this->_props['TokenUsePickupFile'];
|
|
|
445 |
}
|
|
|
446 |
/**
|
|
|
447 |
* Write accessor of TokenUsePickupFile.
|
|
|
448 |
*
|
|
|
449 |
* @access public
|
|
|
450 |
* @param boolean $value The new value for the TokenUsePickupFile property
|
|
|
451 |
* @return void
|
|
|
452 |
*/
|
|
|
453 |
function setTokenUsePickupFile($value)
|
|
|
454 |
{
|
|
|
455 |
$this->_props['TokenUsePickupFile'] = $value;
|
|
|
456 |
}
|
|
|
457 |
/**
|
|
|
458 |
* Read accessor of ApiUrl.
|
|
|
459 |
* returns the API Url
|
|
|
460 |
*
|
|
|
461 |
* @access public
|
|
|
462 |
* @return string Value of the ApiUrl property
|
|
|
463 |
*/
|
|
|
464 |
function getApiUrl()
|
|
|
465 |
{
|
|
|
466 |
return $this->_props['ApiUrl'];
|
|
|
467 |
}
|
|
|
468 |
/**
|
|
|
469 |
* Write accessor of ApiUrl.
|
|
|
470 |
* returns the API Url
|
|
|
471 |
*
|
|
|
472 |
* @access public
|
|
|
473 |
* @param string $value The new value for the ApiUrl property
|
|
|
474 |
* @return void
|
|
|
475 |
*/
|
|
|
476 |
function setApiUrl($value)
|
|
|
477 |
{
|
|
|
478 |
$this->_props['ApiUrl'] = $value;
|
|
|
479 |
}
|
|
|
480 |
/**
|
|
|
481 |
* Read accessor of AppMode.
|
|
|
482 |
* defines which API server to call
|
|
|
483 |
* EBAY_APPMODE_SANDBOX = 1
|
|
|
484 |
* EBAY_APPMODE_QA = 2
|
|
|
485 |
* EBAY_APPMODE_PRODUCTION = 0
|
|
|
486 |
* EBAY_APPMODE_LOCALDEBUG = 100
|
|
|
487 |
*
|
|
|
488 |
* @access public
|
|
|
489 |
* @return define Value of the AppMode property
|
|
|
490 |
*/
|
|
|
491 |
function getAppMode()
|
|
|
492 |
{
|
|
|
493 |
return $this->_props['AppMode'];
|
|
|
494 |
}
|
|
|
495 |
/**
|
|
|
496 |
* Read accessor of PageSize.
|
|
|
497 |
*
|
|
|
498 |
* @access public
|
|
|
499 |
* @return number Value of the PageSize property
|
|
|
500 |
*/
|
|
|
501 |
function getPageSize()
|
|
|
502 |
{
|
|
|
503 |
return $this->_props['PageSize'];
|
|
|
504 |
}
|
|
|
505 |
/**
|
|
|
506 |
* Write accessor of PageSize.
|
|
|
507 |
*
|
|
|
508 |
* @access public
|
|
|
509 |
* @param number $value The new value for the PageSize property
|
|
|
510 |
* @return void
|
|
|
511 |
*/
|
|
|
512 |
function setPageSize($value)
|
|
|
513 |
{
|
|
|
514 |
$this->_props['PageSize'] = $value;
|
|
|
515 |
}
|
|
|
516 |
/**
|
|
|
517 |
* Read accessor of ProxyServer.
|
|
|
518 |
* ProxyServer to pass down to cURL (CURLOPT_PROXY)
|
|
|
519 |
* pass as a string in format "host:port"
|
|
|
520 |
*
|
|
|
521 |
* @access public
|
|
|
522 |
* @return string Value of the ProxyServer property
|
|
|
523 |
*/
|
|
|
524 |
function getProxyServer()
|
|
|
525 |
{
|
|
|
526 |
return $this->_props['ProxyServer'];
|
|
|
527 |
}
|
|
|
528 |
/**
|
|
|
529 |
* Write accessor of ProxyServer.
|
|
|
530 |
* ProxyServer to pass down to cURL (CURLOPT_PROXY)
|
|
|
531 |
* pass as a string in format "host:port"
|
|
|
532 |
*
|
|
|
533 |
* @access public
|
|
|
534 |
* @param string $value The new value for the ProxyServer property
|
|
|
535 |
* @return void
|
|
|
536 |
*/
|
|
|
537 |
function setProxyServer($value)
|
|
|
538 |
{
|
|
|
539 |
$this->_props['ProxyServer'] = $value;
|
|
|
540 |
}
|
|
|
541 |
/**
|
|
|
542 |
* Read accessor of ProxyUidPwd.
|
|
|
543 |
* ProxyServer to pass down to cURL (CURLOPT_PROXYUSERPWD)
|
|
|
544 |
* use "name:password" as a string divided by colon
|
|
|
545 |
*
|
|
|
546 |
* @access public
|
|
|
547 |
* @return string Value of the ProxyUidPwd property
|
|
|
548 |
*/
|
|
|
549 |
function getProxyUidPwd()
|
|
|
550 |
{
|
|
|
551 |
return $this->_props['ProxyUidPwd'];
|
|
|
552 |
}
|
|
|
553 |
/**
|
|
|
554 |
* Write accessor of ProxyUidPwd.
|
|
|
555 |
* ProxyServer to pass down to cURL (CURLOPT_PROXYUSERPWD)
|
|
|
556 |
* use "name:password" as a string divided by colon
|
|
|
557 |
*
|
|
|
558 |
* @access public
|
|
|
559 |
* @param string $value The new value for the ProxyUidPwd property
|
|
|
560 |
* @return void
|
|
|
561 |
*/
|
|
|
562 |
function setProxyUidPwd($value)
|
|
|
563 |
{
|
|
|
564 |
$this->_props['ProxyUidPwd'] = $value;
|
|
|
565 |
}
|
|
|
566 |
/**
|
|
|
567 |
* Read accessor of ProxyServerType.
|
|
|
568 |
* ProxyServer Type to pass down to cURL
|
|
|
569 |
* CURLOPT_PROXYTYPE (101)
|
|
|
570 |
* CURLPROXY_HTTP = 0,
|
|
|
571 |
* CURLPROXY_SOCKS4 = 4,
|
|
|
572 |
* CURLPROXY_SOCKS5 = 5
|
|
|
573 |
* set to EBAY_NOTHING if you are using direct access (default). The cURL operation will acutally check against this value and then use the more abritrate values ProxyXXX
|
|
|
574 |
*
|
|
|
575 |
* @access public
|
|
|
576 |
* @return number Value of the ProxyServerType property
|
|
|
577 |
*/
|
|
|
578 |
function getProxyServerType()
|
|
|
579 |
{
|
|
|
580 |
return $this->_props['ProxyServerType'];
|
|
|
581 |
}
|
|
|
582 |
/**
|
|
|
583 |
* Write accessor of ProxyServerType.
|
|
|
584 |
* ProxyServer Type to pass down to cURL
|
|
|
585 |
* CURLOPT_PROXYTYPE (101)
|
|
|
586 |
* CURLPROXY_HTTP = 0,
|
|
|
587 |
* CURLPROXY_SOCKS4 = 4,
|
|
|
588 |
* CURLPROXY_SOCKS5 = 5
|
|
|
589 |
* set to EBAY_NOTHING if you are using direct access (default). The cURL operation will acutally check against this value and then use the more abritrate values ProxyXXX
|
|
|
590 |
*
|
|
|
591 |
* @access public
|
|
|
592 |
* @param number $value The new value for the ProxyServerType property
|
|
|
593 |
* @return void
|
|
|
594 |
*/
|
|
|
595 |
function setProxyServerType($value)
|
|
|
596 |
{
|
|
|
597 |
$this->_props['ProxyServerType'] = $value;
|
|
|
598 |
}
|
|
|
599 |
/**
|
|
|
600 |
* Read accessor of UseHttpCompression.
|
|
|
601 |
* flag to switch to gzip-encoding for the request. default is true which should be suitable for most situation. If using a very fast internet connection with low data amounts to retrieve might be more efficient to switch the compression of.
|
|
|
602 |
* You will a suitable cURL extension for using this
|
|
|
603 |
*
|
|
|
604 |
* @access public
|
|
|
605 |
* @return boolean Value of the UseHttpCompression property
|
|
|
606 |
*/
|
|
|
607 |
function getUseHttpCompression()
|
|
|
608 |
{
|
|
|
609 |
return $this->_props['UseHttpCompression'];
|
|
|
610 |
}
|
|
|
611 |
/**
|
|
|
612 |
* Write accessor of UseHttpCompression.
|
|
|
613 |
* flag to switch to gzip-encoding for the request. default is true which should be suitable for most situation. If using a very fast internet connection with low data amounts to retrieve might be more efficient to switch the compression of.
|
|
|
614 |
* You will a suitable cURL extension for using this
|
|
|
615 |
*
|
|
|
616 |
* @access public
|
|
|
617 |
* @param boolean $value The new value for the UseHttpCompression property
|
|
|
618 |
* @return void
|
|
|
619 |
*/
|
|
|
620 |
function setUseHttpCompression($value)
|
|
|
621 |
{
|
|
|
622 |
$this->_props['UseHttpCompression'] = $value;
|
|
|
623 |
}
|
|
|
624 |
/**
|
|
|
625 |
*
|
|
|
626 |
* @access private
|
|
|
627 |
* @var array
|
|
|
628 |
*/
|
|
|
629 |
var $_keys = array();
|
|
|
630 |
/**
|
|
|
631 |
* flag to switch to gzip-encoding for the request. default is true which should be suitable for most situation. If using a very fast internet connection with low data amounts to retrieve might be more efficient to switch the compression of.
|
|
|
632 |
* You will a suitable cURL extension for using this
|
|
|
633 |
*
|
|
|
634 |
* @access private
|
|
|
635 |
* @var array
|
|
|
636 |
*/
|
|
|
637 |
var $_debugSwitches = array();
|
|
|
638 |
/**
|
|
|
639 |
* Read accessor of SerializeFolder.
|
|
|
640 |
* specifies a folder name for (de)serialization. Take care of any security issue on the folder (R/W for the www user or IUSR_xxx on IIS)
|
|
|
641 |
*
|
|
|
642 |
* @access public
|
|
|
643 |
* @return string Value of the SerializeFolder property
|
|
|
644 |
*/
|
|
|
645 |
function getSerializeFolder()
|
|
|
646 |
{
|
|
|
647 |
return $this->_props['SerializeFolder'];
|
|
|
648 |
}
|
|
|
649 |
/**
|
|
|
650 |
* Write accessor of SerializeFolder.
|
|
|
651 |
* specifies a folder name for (de)serialization. Take care of any security issue on the folder (R/W for the www user or IUSR_xxx on IIS)
|
|
|
652 |
*
|
|
|
653 |
* @access public
|
|
|
654 |
* @param string $value The new value for the SerializeFolder property
|
|
|
655 |
* @return void
|
|
|
656 |
*/
|
|
|
657 |
function setSerializeFolder($value)
|
|
|
658 |
{
|
|
|
659 |
$this->_props['SerializeFolder'] = $value;
|
|
|
660 |
}
|
|
|
661 |
/**
|
|
|
662 |
* Read accessor of XmlEncoding.
|
|
|
663 |
* use 0 for UTF-8 encoding (default)
|
|
|
664 |
* as with compat-level 401 no other values are allowed
|
|
|
665 |
*
|
|
|
666 |
* @access public
|
|
|
667 |
* @return number Value of the XmlEncoding property
|
|
|
668 |
*/
|
|
|
669 |
function getXmlEncoding()
|
|
|
670 |
{
|
|
|
671 |
return $this->_props['XmlEncoding'];
|
|
|
672 |
}
|
|
|
673 |
/**
|
|
|
674 |
* Write accessor of XmlEncoding.
|
|
|
675 |
* use 0 for UTF-8 encoding (default)
|
|
|
676 |
* as with compat-level 401 no other values are allowed
|
|
|
677 |
*
|
|
|
678 |
* @access public
|
|
|
679 |
* @param number $value The new value for the XmlEncoding property
|
|
|
680 |
* @return void
|
|
|
681 |
*/
|
|
|
682 |
function setXmlEncoding($value)
|
|
|
683 |
{
|
|
|
684 |
$this->_props['XmlEncoding'] = $value;
|
|
|
685 |
}
|
|
|
686 |
/**
|
|
|
687 |
* Read accessor of DoXmlUtf8Decoding.
|
|
|
688 |
* set this flag will result in decode all incoming data to iso-8859-1 using php utf8_decode.
|
|
|
689 |
*
|
|
|
690 |
* @access public
|
|
|
691 |
* @return boolean Value of the DoXmlUtf8Decoding property
|
|
|
692 |
*/
|
|
|
693 |
function getDoXmlUtf8Decoding()
|
|
|
694 |
{
|
|
|
695 |
return $this->_props['DoXmlUtf8Decoding'];
|
|
|
696 |
}
|
|
|
697 |
/**
|
|
|
698 |
* Write accessor of DoXmlUtf8Decoding.
|
|
|
699 |
* set this flag will result in decode all incoming data to iso-8859-1 using php utf8_decode.
|
|
|
700 |
*
|
|
|
701 |
* @access public
|
|
|
702 |
* @param boolean $value The new value for the DoXmlUtf8Decoding property
|
|
|
703 |
* @return void
|
|
|
704 |
*/
|
|
|
705 |
function setDoXmlUtf8Decoding($value)
|
|
|
706 |
{
|
|
|
707 |
$this->_props['DoXmlUtf8Decoding'] = $value;
|
|
|
708 |
}
|
|
|
709 |
/**
|
|
|
710 |
* Read accessor of DoXmlUtf8Encoding.
|
|
|
711 |
* set this flag will result in encode all outgoing data to uft-8 assuming the data set to the objects are in iso-8859-1 characterset.
|
|
|
712 |
*
|
|
|
713 |
* @access public
|
|
|
714 |
* @return boolean Value of the DoXmlUtf8Encoding property
|
|
|
715 |
*/
|
|
|
716 |
function getDoXmlUtf8Encoding()
|
|
|
717 |
{
|
|
|
718 |
return $this->_props['DoXmlUtf8Encoding'];
|
|
|
719 |
}
|
|
|
720 |
/**
|
|
|
721 |
* Write accessor of DoXmlUtf8Encoding.
|
|
|
722 |
* set this flag will result in encode all outgoing data to uft-8 assuming the data set to the objects are in iso-8859-1 characterset.
|
|
|
723 |
*
|
|
|
724 |
* @access public
|
|
|
725 |
* @param boolean $value The new value for the DoXmlUtf8Encoding property
|
|
|
726 |
* @return void
|
|
|
727 |
*/
|
|
|
728 |
function setDoXmlUtf8Encoding($value)
|
|
|
729 |
{
|
|
|
730 |
$this->_props['DoXmlUtf8Encoding'] = $value;
|
|
|
731 |
}
|
|
|
732 |
/**
|
|
|
733 |
* Read accessor of RawLogMode.
|
|
|
734 |
* Set to true to turn raw log-mode on
|
|
|
735 |
*
|
|
|
736 |
* @access public
|
|
|
737 |
* @return boolean Value of the RawLogMode property
|
|
|
738 |
*/
|
|
|
739 |
function getRawLogMode()
|
|
|
740 |
{
|
|
|
741 |
return $this->_props['RawLogMode'];
|
|
|
742 |
}
|
|
|
743 |
/**
|
|
|
744 |
* Write accessor of RawLogMode.
|
|
|
745 |
* Set to true to turn raw log-mode on
|
|
|
746 |
*
|
|
|
747 |
* @access public
|
|
|
748 |
* @param boolean $value The new value for the RawLogMode property
|
|
|
749 |
* @return void
|
|
|
750 |
*/
|
|
|
751 |
function setRawLogMode($value)
|
|
|
752 |
{
|
|
|
753 |
$this->_props['RawLogMode'] = $value;
|
|
|
754 |
}
|
|
|
755 |
/**
|
|
|
756 |
* Read accessor of RawLogPath.
|
|
|
757 |
* Path where to place RawLogged Files
|
|
|
758 |
*
|
|
|
759 |
* @access public
|
|
|
760 |
* @return string Value of the RawLogPath property
|
|
|
761 |
*/
|
|
|
762 |
function getRawLogPath()
|
|
|
763 |
{
|
|
|
764 |
return $this->_props['RawLogPath'];
|
|
|
765 |
}
|
|
|
766 |
/**
|
|
|
767 |
* Write accessor of RawLogPath.
|
|
|
768 |
* Path where to place RawLogged Files
|
|
|
769 |
*
|
|
|
770 |
* @access public
|
|
|
771 |
* @param string $value The new value for the RawLogPath property
|
|
|
772 |
* @return void
|
|
|
773 |
*/
|
|
|
774 |
function setRawLogPath($value)
|
|
|
775 |
{
|
|
|
776 |
$this->_props['RawLogPath'] = $value;
|
|
|
777 |
}
|
|
|
778 |
/**
|
|
|
779 |
* Read accessor of RawLogSeq.
|
|
|
780 |
* Seq No for paginated results within a Raw Logging Session, will be incremented after a log is written
|
|
|
781 |
*
|
|
|
782 |
* @access public
|
|
|
783 |
* @return number Value of the RawLogSeq property
|
|
|
784 |
*/
|
|
|
785 |
function getRawLogSeq()
|
|
|
786 |
{
|
|
|
787 |
return $this->_props['RawLogSeq'];
|
|
|
788 |
}
|
|
|
789 |
/**
|
|
|
790 |
* Write accessor of RawLogSeq.
|
|
|
791 |
* Seq No for paginated results within a Raw Logging Session, will be incremented after a log is written
|
|
|
792 |
*
|
|
|
793 |
* @access public
|
|
|
794 |
* @param number $value The new value for the RawLogSeq property
|
|
|
795 |
* @return void
|
|
|
796 |
*/
|
|
|
797 |
function setRawLogSeq($value)
|
|
|
798 |
{
|
|
|
799 |
$this->_props['RawLogSeq'] = $value;
|
|
|
800 |
}
|
|
|
801 |
/**
|
|
|
802 |
* Read accessor of RawLogName.
|
|
|
803 |
* Name of the file to write in RawLogMode, if not given the API methodname is used.
|
|
|
804 |
* The resulting filename is RawLogPath + "/" + RawLogName + "_" + RawLogSeq + ".xml"
|
|
|
805 |
*
|
|
|
806 |
* @access public
|
|
|
807 |
* @return string Value of the RawLogName property
|
|
|
808 |
*/
|
|
|
809 |
function getRawLogName()
|
|
|
810 |
{
|
|
|
811 |
return $this->_props['RawLogName'];
|
|
|
812 |
}
|
|
|
813 |
/**
|
|
|
814 |
* Write accessor of RawLogName.
|
|
|
815 |
* Name of the file to write in RawLogMode, if not given the API methodname is used.
|
|
|
816 |
* The resulting filename is RawLogPath + "/" + RawLogName + "_" + RawLogSeq + ".xml"
|
|
|
817 |
*
|
|
|
818 |
* @access public
|
|
|
819 |
* @param string $value The new value for the RawLogName property
|
|
|
820 |
* @return void
|
|
|
821 |
*/
|
|
|
822 |
function setRawLogName($value)
|
|
|
823 |
{
|
|
|
824 |
$this->_props['RawLogName'] = $value;
|
|
|
825 |
}
|
|
|
826 |
/**
|
|
|
827 |
*
|
|
|
828 |
* @access private
|
|
|
829 |
* @var Ebay _CryptoProvider
|
|
|
830 |
*/
|
|
|
831 |
var $_CryptoProvider = null;
|
|
|
832 |
/**
|
|
|
833 |
* Standard init function, should be called from the constructor(s)
|
|
|
834 |
*/
|
|
|
835 |
function _init()
|
|
|
836 |
{
|
|
|
837 |
$this->_props['AppId'] = EBAY_NOTHING;
|
|
|
838 |
$this->_props['DevId'] = EBAY_NOTHING;
|
|
|
839 |
$this->_props['CertId'] = EBAY_NOTHING;
|
|
|
840 |
$this->_props['RequestPassword'] = EBAY_NOTHING;
|
|
|
841 |
$this->_props['RequestUser'] = EBAY_NOTHING;
|
|
|
842 |
$this->_props['TimeOffset'] = EBAY_NOTHING;
|
|
|
843 |
$this->_props['LogLevel'] = EBAY_NOTHING;
|
|
|
844 |
$this->_props['LogFilename'] = EBAY_NOTHING;
|
|
|
845 |
$this->_props['LogMode'] = 0;
|
|
|
846 |
$this->_props['ApiMode'] = EBAY_NOTHING;
|
|
|
847 |
$this->_props['SiteId'] = EBAY_NOTHING;
|
|
|
848 |
$this->_props['CompatibilityLevel'] = EBAY_NOTHING;
|
|
|
849 |
$this->_props['ErrorLevel'] = EBAY_NOTHING;
|
|
|
850 |
$this->_props['ErrorLanguage'] = 0;
|
|
|
851 |
$this->_props['RequestTimeout'] = EBAY_NOTHING;
|
|
|
852 |
$this->_props['TokenMode'] = false;
|
|
|
853 |
$this->_props['TokenPickupFile'] = EBAY_NOTHING;
|
|
|
854 |
$this->_props['TokenUsePickupFile'] = false;
|
|
|
855 |
$this->_props['ApiUrl'] = EBAY_NOTHING;
|
|
|
856 |
$this->_props['AppMode'] = EBAY_NOTHING;
|
|
|
857 |
$this->_props['PageSize'] = 200;
|
|
|
858 |
$this->_props['ProxyServer'] = EBAY_NOTHING;
|
|
|
859 |
$this->_props['ProxyUidPwd'] = EBAY_NOTHING;
|
|
|
860 |
$this->_props['ProxyServerType'] = EBAY_NOTHING;
|
|
|
861 |
$this->_props['UseHttpCompression'] = false;
|
|
|
862 |
$this->_props['SerializeFolder'] = null;
|
|
|
863 |
$this->_props['XmlEncoding'] = 0;
|
|
|
864 |
$this->_props['DoXmlUtf8Decoding'] = false;
|
|
|
865 |
$this->_props['DoXmlUtf8Encoding'] = false;
|
|
|
866 |
$this->_props['RawLogMode'] = false;
|
|
|
867 |
$this->_props['RawLogPath'] = EBAY_NOTHING;
|
|
|
868 |
$this->_props['RawLogSeq'] = 1;
|
|
|
869 |
$this->_props['RawLogName'] = EBAY_NOTHING;
|
|
|
870 |
}
|
|
|
871 |
/**
|
|
|
872 |
*
|
|
|
873 |
* @access public
|
|
|
874 |
* @param string $configFile Path to a config-file (ini-style) to read main config parameters from.
|
|
|
875 |
* @return boolean
|
|
|
876 |
*/
|
|
|
877 |
function InitFromConfig($configFile)
|
|
|
878 |
{
|
|
|
879 |
$cfg = parse_ini_file($configFile);
|
|
|
880 |
if ($cfg == false) {
|
|
|
881 |
$this->LogMsg("config file not found", 0, E_ERROR);
|
|
|
882 |
}
|
|
|
883 |
$this->_keys['test'] = array($cfg['app-key-test'], $cfg['dev-key-test'], $cfg['cert-id-test']);
|
|
|
884 |
$this->_keys['prod'] = array($cfg['app-key-prod'], $cfg['dev-key-prod'], $cfg['cert-id-prod']);
|
|
|
885 |
if (isset($cfg['site-id']))
|
|
|
886 |
$this->setSiteId($cfg['site-id']);
|
|
|
887 |
if (isset($cfg['user']))
|
|
|
888 |
$this->setRequestUser($cfg['user']);
|
|
|
889 |
if (isset($cfg['password']))
|
|
|
890 |
$this->setRequestPassword($cfg['password']);
|
|
|
891 |
if (isset($cfg['app-mode']))
|
|
|
892 |
$this->setAppMode($cfg['app-mode']);
|
|
|
893 |
if (isset($cfg['api-mode']))
|
|
|
894 |
$this->setApiMode($cfg['api-mode']);
|
|
|
895 |
if (isset($cfg['compat-level']))
|
|
|
896 |
$this->setCompatibilityLevel($cfg['compat-level']);
|
|
|
897 |
if (isset($cfg['error-level']))
|
|
|
898 |
$this->setErrorLevel($cfg['error-level']);
|
|
|
899 |
if (isset($cfg['request-timeout']))
|
|
|
900 |
$this->setRequestTimeout($cfg['request-timeout']);
|
|
|
901 |
if (isset($cfg['serialize-folder']))
|
|
|
902 |
$this->setSerializeFolder($cfg['serialize-folder']);
|
|
|
903 |
if (isset($cfg['token-mode'])) {
|
|
|
904 |
$this->setTokenMode($cfg['token-mode']);
|
|
|
905 |
if (isset($cfg['token-pickup-file'])) {
|
|
|
906 |
$this->setTokenPickupFile($cfg['token-pickup-file']);
|
|
|
907 |
$this->setTokenUsePickupFile(true);
|
|
|
908 |
}
|
|
|
909 |
}
|
|
|
910 |
// only utf-8 encoding is allowed !!!
|
|
|
911 |
$this->setXmlEncoding(0);
|
|
|
912 |
if (isset($cfg['error-language'])) {
|
|
|
913 |
$this->setErrorLanguage($cfg['error-language']);
|
|
|
914 |
}else {
|
|
|
915 |
$this->setErrorLanguage(0);
|
|
|
916 |
}
|
|
|
917 |
if (isset($cfg['xml-extra-decode'])) {
|
|
|
918 |
$this->setDoXmlUtf8Decoding($cfg['xml-extra-decode']);
|
|
|
919 |
}else {
|
|
|
920 |
$this->setDoXmlUtf8Decoding(0);
|
|
|
921 |
}
|
|
|
922 |
if (isset($cfg['xml-extra-encode'])) {
|
|
|
923 |
$this->setDoXmlUtf8Encoding($cfg['xml-extra-encode']);
|
|
|
924 |
}else {
|
|
|
925 |
$this->setDoXmlUtf8Encoding(0);
|
|
|
926 |
}
|
|
|
927 |
if (isset($cfg['use-http-compression'])) {
|
|
|
928 |
$this->setUseHttpCompression($cfg['use-http-compression']);
|
|
|
929 |
}
|
|
|
930 |
if (isset($cfg['log-file'])) {
|
|
|
931 |
$this->setLogFilename($cfg['log-file']);
|
|
|
932 |
}
|
|
|
933 |
if (isset($cfg['log-level'])) {
|
|
|
934 |
$this->setLogLevel($cfg['log-level']);
|
|
|
935 |
}
|
|
|
936 |
if (isset($cfg['log-mode'])) {
|
|
|
937 |
$this->setLogMode($cfg['log-mode']);
|
|
|
938 |
}
|
|
|
939 |
if (isset($cfg['debug-showin'])) {
|
|
|
940 |
$this->setDebugSwitch('showin');
|
|
|
941 |
}
|
|
|
942 |
if (isset($cfg['debug-showout'])) {
|
|
|
943 |
$this->setDebugSwitch('showout');
|
|
|
944 |
}
|
|
|
945 |
if (isset($cfg['debug-profiling'])) {
|
|
|
946 |
$this->setDebugSwitch('profiling');
|
|
|
947 |
}
|
|
|
948 |
if (isset($cfg['debug-curl-verbose'])) {
|
|
|
949 |
$this->setDebugSwitch('curl-verbose');
|
|
|
950 |
}
|
|
|
951 |
if (isset($cfg['raw-log-mode'])) {
|
|
|
952 |
$this->setRawLogMode($cfg['raw-log-mode']);
|
|
|
953 |
}
|
|
|
954 |
if (isset($cfg['raw-log-path'])) {
|
|
|
955 |
$this->setRawLogPath($cfg['raw-log-path']);
|
|
|
956 |
}
|
|
|
957 |
if (isset($cfg['raw-log-name'])) {
|
|
|
958 |
$this->setRawLogName($cfg['raw-log-name']);
|
|
|
959 |
}
|
|
|
960 |
if (isset($cfg['raw-log-seq'])) {
|
|
|
961 |
$this->setRawLogSeq($cfg['raw-log-seq']);
|
|
|
962 |
}
|
|
|
963 |
if (isset($cfg['max-transactions-per-page'])) {
|
|
|
964 |
$this->_props['PageSize'] = $cfg['max-transactions-per-page'];
|
|
|
965 |
if ($this->_props['PageSize'] <= 0)
|
|
|
966 |
$this->_props['PageSize'] = 200;
|
|
|
967 |
}
|
|
|
968 |
if (isset($cfg['use_standard_logger'])) {
|
|
|
969 |
$this->setUseStandardLogger($cfg['use_standard_logger']);
|
|
|
970 |
}
|
|
|
971 |
}
|
|
|
972 |
/**
|
|
|
973 |
* Writes a log-message to the logFile
|
|
|
974 |
*
|
|
|
975 |
* @access public
|
|
|
976 |
* @param string $msg
|
|
|
977 |
* @param number $errNo
|
|
|
978 |
* @param number $severity
|
|
|
979 |
* @return void
|
|
|
980 |
*/
|
|
|
981 |
function LogMsg($msg, $errNo, $severity)
|
|
|
982 |
{
|
|
|
983 |
$dt = date("Y-m-d H:i:s (T)");
|
|
|
984 |
$errStr = "$dt,#$errNo,$severity,$msg\r\n";
|
|
|
985 |
$destination = $this->getLogFilename();
|
|
|
986 |
switch ($this->getLogMode()) {
|
|
|
987 |
case 0:
|
|
|
988 |
error_log($errStr, 0);
|
|
|
989 |
break;
|
|
|
990 |
case 1:
|
|
|
991 |
// TODO
|
|
|
992 |
// assume the logfile name as an email address
|
|
|
993 |
error_log($errStr, 1, $destination);
|
|
|
994 |
break;
|
|
|
995 |
case 2:
|
|
|
996 |
// TODO
|
|
|
997 |
// assume the logfile name as the debugger port
|
|
|
998 |
error_log($errStr, 2, $destination);
|
|
|
999 |
break;
|
|
|
1000 |
case 3:
|
|
|
1001 |
error_log($errStr, 3, $destination);
|
|
|
1002 |
break;
|
|
|
1003 |
} // switch
|
|
|
1004 |
// TODO
|
|
|
1005 |
// maybe die here on fatal errors
|
|
|
1006 |
}
|
|
|
1007 |
/**
|
|
|
1008 |
* special processing needed for AppMode
|
|
|
1009 |
*
|
|
|
1010 |
* @access public
|
|
|
1011 |
* @param define $value
|
|
|
1012 |
* @return void
|
|
|
1013 |
*/
|
|
|
1014 |
function setAppMode($value)
|
|
|
1015 |
{
|
|
|
1016 |
$this->_props['AppMode'] = $value;
|
|
|
1017 |
// setting the URL for the API
|
|
|
1018 |
// recording to the AppMode selected
|
|
|
1019 |
switch ($value) {
|
|
|
1020 |
case 0:
|
|
|
1021 |
$this->_setProp('ApiUrl', 'https://api.ebay.com/wsapi');
|
|
|
1022 |
$this->_setProp('AppId', $this->_keys['prod'][0]);
|
|
|
1023 |
$this->_setProp('DevId', $this->_keys['prod'][1]);
|
|
|
1024 |
$this->_setProp('CertId', $this->_keys['prod'][2]);
|
|
|
1025 |
break;
|
|
|
1026 |
case 1:
|
|
|
1027 |
$this->_setProp('ApiUrl', 'https://api.sandbox.ebay.com/wsapi');
|
|
|
1028 |
$this->_setProp('AppId', $this->_keys['test'][0]);
|
|
|
1029 |
$this->_setProp('DevId', $this->_keys['test'][1]);
|
|
|
1030 |
$this->_setProp('CertId', $this->_keys['test'][2]);
|
|
|
1031 |
break;
|
|
|
1032 |
case 2:
|
|
|
1033 |
$this->_setProp('ApiUrl', 'https://api.ebay.com/wsapi');
|
|
|
1034 |
$this->_setProp('AppId', $this->_keys['test'][0]);
|
|
|
1035 |
$this->_setProp('DevId', $this->_keys['test'][1]);
|
|
|
1036 |
$this->_setProp('CertId', $this->_keys['test'][2]);
|
|
|
1037 |
break;
|
|
|
1038 |
}
|
|
|
1039 |
}
|
|
|
1040 |
/**
|
|
|
1041 |
*
|
|
|
1042 |
* @access public
|
|
|
1043 |
* @param string $configFile
|
|
|
1044 |
* @return void
|
|
|
1045 |
*/
|
|
|
1046 |
function EbatNs_Session($configFile = null)
|
|
|
1047 |
{
|
|
|
1048 |
// call to initialisation
|
|
|
1049 |
// (be sure to call this always on the actual class and prevent any overwriting)
|
|
|
1050 |
EbatNs_Session::_init();
|
|
|
1051 |
$this->_props['RequestToken'] = EBAY_NOTHING;
|
|
|
1052 |
if ($configFile != null) {
|
|
|
1053 |
$this->InitFromConfig($configFile);
|
|
|
1054 |
}
|
|
|
1055 |
}
|
|
|
1056 |
/**
|
|
|
1057 |
* sets various internal debug switches
|
|
|
1058 |
*
|
|
|
1059 |
* @access public
|
|
|
1060 |
* @param string $switch use one the following switches (string)
|
|
|
1061 |
* 'showin' prints raw input (headers, xml)
|
|
|
1062 |
* 'showout' print raw output (xml)
|
|
|
1063 |
* 'logout' saves all ouput to a log-file with lays under /var/tmp with the name of the API-call and .log
|
|
|
1064 |
* 'pickoutlog' instead of making the call the log-file from 'logout' is picked up. Attention not suitable for paginated results.
|
|
|
1065 |
* 'profile' logs profiling information for any API-logs
|
|
|
1066 |
* @param boolean $onoff
|
|
|
1067 |
* @return void
|
|
|
1068 |
*/
|
|
|
1069 |
function setDebugSwitch($switch, $onoff = true)
|
|
|
1070 |
{
|
|
|
1071 |
if ($onoff == true) {
|
|
|
1072 |
$this->_debugSwitches["$switch"] = true;
|
|
|
1073 |
}else {
|
|
|
1074 |
unset($this->_debugSwitches["$switch"]);
|
|
|
1075 |
}
|
|
|
1076 |
}
|
|
|
1077 |
/**
|
|
|
1078 |
* reads the content of the TokenFile to the Attribute RequestToken. If you are running in TokenMode the TokenFile and the Flag 'TokenUsePickupFile' is true the fill will be read whenever a call this made.
|
|
|
1079 |
*
|
|
|
1080 |
* @access public
|
|
|
1081 |
* @return void
|
|
|
1082 |
*/
|
|
|
1083 |
function ReadTokenFile()
|
|
|
1084 |
{
|
|
|
1085 |
if ($this->getTokenUsePickupFile()) {
|
|
|
1086 |
$fname = $this->getTokenPickupFile();
|
|
|
1087 |
$fh = fopen($fname, "r");
|
|
|
1088 |
$this->_props['RequestToken'] = trim(fread($fh, filesize($fname)));
|
|
|
1089 |
fclose($fh);
|
|
|
1090 |
}
|
|
|
1091 |
}
|
|
|
1092 |
/**
|
|
|
1093 |
* Writes the content of the Attribute RequestToken to the TokenFile. If the ApiCaller detects a RefreshToken after a call the new token will get automatically writen to the file.
|
|
|
1094 |
*
|
|
|
1095 |
* @access public
|
|
|
1096 |
* @return void
|
|
|
1097 |
*/
|
|
|
1098 |
function WriteTokenFile()
|
|
|
1099 |
{
|
|
|
1100 |
if ($this->getTokenUsePickupFile()) {
|
|
|
1101 |
$fname = $this->getTokenPickupFile();
|
|
|
1102 |
$fh = fopen($fname, "w+");
|
|
|
1103 |
fwrite($fh, $this->_props['RequestToken']);
|
|
|
1104 |
fclose($fh);
|
|
|
1105 |
}
|
|
|
1106 |
}
|
|
|
1107 |
/**
|
|
|
1108 |
*
|
|
|
1109 |
* @access public
|
|
|
1110 |
* @param $ <unspecified> $data
|
|
|
1111 |
* @return void
|
|
|
1112 |
*/
|
|
|
1113 |
function EncyrptData($data)
|
|
|
1114 |
{
|
|
|
1115 |
if ($this->_CryptoProvider != null)
|
|
|
1116 |
return $this->_CryptoProvider->Encrypt($data);
|
|
|
1117 |
else
|
|
|
1118 |
return $data;
|
|
|
1119 |
}
|
|
|
1120 |
/**
|
|
|
1121 |
*
|
|
|
1122 |
* @access public
|
|
|
1123 |
* @param $ <unspecified> $data
|
|
|
1124 |
* @return void
|
|
|
1125 |
*/
|
|
|
1126 |
function DecyrptData($data)
|
|
|
1127 |
{
|
|
|
1128 |
if ($this->_CryptoProvider != null)
|
|
|
1129 |
return $this->_CryptoProvider->Decrypt($data);
|
|
|
1130 |
else
|
|
|
1131 |
return $data;
|
|
|
1132 |
}
|
|
|
1133 |
/**
|
|
|
1134 |
*
|
|
|
1135 |
* @access public
|
|
|
1136 |
* @param Ebay $ _CryptoProvider $provider
|
|
|
1137 |
* @return void
|
|
|
1138 |
*/
|
|
|
1139 |
function setCryptoProvider($provider)
|
|
|
1140 |
{
|
|
|
1141 |
$this->_CryptoProvider = $provider;
|
|
|
1142 |
}
|
|
|
1143 |
/**
|
|
|
1144 |
*
|
|
|
1145 |
* @access public
|
|
|
1146 |
* @return void
|
|
|
1147 |
*/
|
|
|
1148 |
function getRequestToken()
|
|
|
1149 |
{
|
|
|
1150 |
return $this->DecyrptData($this->_props['RequestToken']);
|
|
|
1151 |
}
|
|
|
1152 |
/**
|
|
|
1153 |
*
|
|
|
1154 |
* @access public
|
|
|
1155 |
* @param string $value
|
|
|
1156 |
* @return void
|
|
|
1157 |
*/
|
|
|
1158 |
function setRequestToken($value)
|
|
|
1159 |
{
|
|
|
1160 |
$this->_props['RequestToken'] = $this->EncyrptData($value);
|
|
|
1161 |
}
|
|
|
1162 |
|
|
|
1163 |
/**
|
|
|
1164 |
*
|
|
|
1165 |
* @access public
|
|
|
1166 |
* @param string $value
|
|
|
1167 |
* @return void
|
|
|
1168 |
*/
|
|
|
1169 |
function setUseStandardLogger($value)
|
|
|
1170 |
{
|
|
|
1171 |
$this->_props['UseStandardLogger'] = $value;
|
|
|
1172 |
}
|
|
|
1173 |
/**
|
|
|
1174 |
*
|
|
|
1175 |
* @access public
|
|
|
1176 |
* @return void
|
|
|
1177 |
*/
|
|
|
1178 |
function getUseStandardLogger()
|
|
|
1179 |
{
|
|
|
1180 |
return ($this->_props['UseStandardLogger'] ? true : false);
|
|
|
1181 |
}
|
|
|
1182 |
}
|
|
|
1183 |
|
|
|
1184 |
?>
|