I'm using an API to get domain DNS details. The results printed show like this:
stdClass Object
(
[test.co.uk] => stdClass Object
(
[records] => Array
(
[0] => stdClass Object
(
[mname] => ns1.test.com.
[rname] => hostmaster.test.com.
[serial] => 12345678
[refresh] => 1800
[retry] => 900
[expire] => 1209600
[minimum-ttl] => 300
[ref] =>
[host] => test.co.uk
[type] => SOA
)
[1] => stdClass Object
(
[target] => ns1.test.com
[ref] =>
[host] => test.co.uk
[type] => NS
)
[2] => stdClass Object
(
[target] => ns2.test.com
[ref] =>
[host] => test.co.uk
[type] => NS
)
How can I turn each of the records ([0], [1], [2] etc) into variables? I am wanting to show them in a table
I have tried the below, but no result is shown
$Test=$PackageDNSInfo->test.co.uk->records[0]->mname;
echo $Test;
$PackageDNSInfo->{'test.co.uk'}->records[0]->mname;foreachon a stdClass object if you'd like (key will be the property name, value will be its value).