Php json api

Hello there
Check the firewall tool IP list.
I want to see only id and registered ip[value] values ​​in php.

I tried the method as an example, but it doesn’t work.
please tell me how
thank you.

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, “https://api.cloudflare.com/client/v4/zones/myip/firewall/access_rules/rules”);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, “GET”);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$jsonarray = curl_exec($ch);
$newarray = json_decode(trim($jsonarray), TRUE);

echo $newarray[“result”][“id”]
echo $newarray[“result”][“value”]


reult

=> Array ( [0] => Array ( [id] => b5dfb2c4e3e7493ba9f04~~ [paused] => [modified_on] => 2021-09-04T04:39:24.834944Z [allowed_modes] => Array ( [0] => whitelist [1] => block [2] => challenge [3] => js_challenge ) [mode] => block [notes] => [configuration] => Array ( [target] => ip [value] => 58.69.~~ ) [scope] => Array ( [id] => f9a10f3c295f8c385b6a3~~ [name] => n1232 [type] => zone ) [created_on] => 2021-09-04T04:39:24.86804595Z ) ) [success] => 1 [errors] => Array ( ) [messages] => Array ( ) [result_info] => Array ( [page] => 1 [per_page] => 25 [count] => 1 [total_count] => 1 [total_pages] => 1 ) )

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.