0

I have this returned from an eBay API. How can I access the values in count using PHP?

(
    [ack] => Success
    [version] => 1.13.0
    [timestamp] => 2020-04-13T00:01:52.128Z
    [searchResult] => SimpleXMLElement Object
        (
            [@attributes] => Array
                (
                    [count] => 0
                )

        )
...

I have tried the following but to no avail

$x->searchResult->@attributes->count;

$x->searchResult['@attributes']->count;

  • You can just use `$x->searchResult['count']` or `$x->searchResult->attributes()->count` – Nick Apr 13 '20 at 00:27

1 Answers1

0

To see all attributes use

foreach ($xml->searchResult->attributes() as $a=>$b)
    echo "[$a] = $b <BR>";