Getting this type of response from the eBay API:
DTS\eBaySDK\Trading\Types\GetCategoriesResponseType Object
(
[values:DTS\eBaySDK\Types\BaseType:private] => Array
(
[Timestamp] => DateTime Object
(
[date] => 2019-12-07 22:25:23.938000
[timezone_type] => 2
[timezone] => Z
)
[Ack] => Success
[Version] => 1119
[Build] => E1119_CORE_APICATALOG_19043596_R1
[CategoryArray] => DTS\eBaySDK\Trading\Types\CategoryArrayType Object
using this function to recursively create an array out of the objects.
function object_to_array($obj) {
if(is_object($obj) || is_array($obj)) {
$ret = (array) $obj;
foreach($ret as &$item) {
$item = object_to_array($item);
}
return $ret;
}
else {
return $obj;
}
}
This works and output is this with a print_r
Array
(
[DTS\eBaySDK\Types\BaseTypevalues] => Array
(
[Timestamp] => Array
(
[date] => 2019-12-07 22:27:15.925000
[timezone_type] => 2
[timezone] => Z
)
[Ack] => Success
[Version] => 1119
[Build] => E1119_CORE_APICATALOG_19043596_R1
[CategoryArray] => Array
(
[DTS\eBaySDK\Types\BaseTypevalues] => Array
But then I did a var_dump on the array and noticed this:
array (size=2)
'�DTS\eBaySDK\Types\BaseType�values' =>
array (size=5)
'Timestamp' =>
array (size=3)
'date' => string '2019-12-07 22:23:51.847000' (length=26)
'timezone_type' => int 2
'timezone' => string 'Z' (length=1)
'Ack' => string 'Success' (length=7)
'Version' => string '1119' (length=4)
'Build' => string 'E1119_CORE_APICATALOG_19043596_R1' (length=33)
'CategoryArray' =>
array (size=2)
'�DTS\eBaySDK\Types\BaseType�values' =>
I've tried just copying and pasting-- $responsearray['�DTS\eBaySDK\Types\BaseType�values']
But just get the error
Notice: Undefined index: �DTS\eBaySDK\Types\BaseType�values
How can I work with these keys and access these array elements?