I'm getting response from an API as JSON object, below is the JSON object that I am getting. I am trying to access some fields from it, but somehow, it is not working.
I am very new to API and JSON, so any help will be great.
{
[
"result"
]=>object(stdClass)#5(17){
[
"id"
]=>string(32)"f3add916cd34d635cb88452f4b024028"[
"name"
]=>string(12)"domain.com"[
"status"
]=>string(7)"pending"[
"paused"
]=>bool(false)[
"type"
]=>string(4)"full"[
"development_mode"
]=>int(0)[
"name_servers"
]=>array(2){
[
0
]=>string(21)"asa.ns.cloudflare.com"[
1
]=>string(22)"gabe.ns.cloudflare.com"
}[
"original_name_servers"
]=>array(2){
[
0
]=>string(26)"dns1.registrar-servers.com"[
1
]=>string(26)"dns2.registrar-servers.com"
}[
"original_registrar"
]=>NULL[
"original_dnshost"
]=>NULL[
"modified_on"
]=>string(27)"2017-08-22T10:03:26.537122Z"[
"created_on"
]=>string(27)"2017-08-22T10:03:26.537122Z"[
"meta"
]=>object(stdClass)#6(6){
[
"step"
]=>int(4)[
"wildcard_proxiable"
]=>bool(false)[
"custom_certificate_quota"
]=>int(0)[
"page_rule_quota"
]=>int(3)[
"phishing_detected"
]=>bool(false)[
"multiple_railguns_allowed"
]=>bool(false)
}[
"owner"
]=>object(stdClass)#7(3){
[
"id"
]=>string(32)"a1a492e3c3345ff4c84a569838d56967"[
"type"
]=>string(4)"user"[
"email"
]=>string(20)"email.com"
}[
"account"
]=>object(stdClass)#8(1){
[
"id"
]=>string(32)"myID"
}[
"permissions"
]=>array(22){
[
0
]=>string(15)"#analytics:read"[
1
]=>string(9)"#app:edit"[
2
]=>string(13)"#billing:edit"[
3
]=>string(13)"#billing:read"[
4
]=>string(17)"#cache_purge:edit"[
5
]=>string(17)"#dns_records:edit"[
6
]=>string(17)"#dns_records:read"[
7
]=>string(8)"#lb:edit"[
8
]=>string(8)"#lb:read"[
9
]=>string(10)"#logs:read"[
10
]=>string(12)"#member:edit"[
11
]=>string(12)"#member:read"[
12
]=>string(18)"#organization:edit"[
13
]=>string(18)"#organization:read"[
14
]=>string(9)"#ssl:edit"[
15
]=>string(9)"#ssl:read"[
16
]=>string(9)"#waf:edit"[
17
]=>string(9)"#waf:read"[
18
]=>string(10)"#zone:edit"[
19
]=>string(10)"#zone:read"[
20
]=>string(19)"#zone_settings:edit"[
21
]=>string(19)"#zone_settings:read"
}[
"plan"
]=>object(stdClass)#9(10){
[
"id"
]=>string(32)"0feeeeeeeeeeeeeeeeeeeeeeeeeeeeee"[
"name"
]=>string(12)"Free Website"[
"price"
]=>int(0)[
"currency"
]=>string(3)"USD"[
"frequency"
]=>string(0)""[
"is_subscribed"
]=>bool(true)[
"can_subscribe"
]=>bool(false)[
"legacy_id"
]=>string(4)"free"[
"legacy_discount"
]=>bool(false)[
"externally_managed"
]=>bool(false)
}
}[
"success"
]=>bool(true)[
"errors"
]=>array(0){
}[
"messages"
]=>array(0){
}
}
How do I access the ID variable within "result" or both the nameservers?
I've tried this, doesn't work.
foreach($a as $b=>$c)
{
echo $b . "=" . $c;
echo "<br>";
}
$a contains the json object. Please guide me right direction.