php
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.xxx.com/api/pool_stats?pool_type=xxx,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer ' xxxxxxxxxxxxxxxxxxx
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
运行后返回的数据如下
返回数据1
{"id":329859,"label":"test","login":"ca60d32539d18111111","password":"aedb27f5e92d1111","balance":5368033729,"balance_format":"5 GB","threads":2000,"sticky_range":{"start":10000,"end":30000},"allowed_ips":[],"blocked":false,"pool_type":"datacenter","default_pool_parameters":{"countries":["us"],"cities":[""],"states":[""],"zipcodes":[],"asns":[],"exclude_countries":[],"exclude_asn":[],"anonymous_filter":false,"rotation_interval":20},"blocked_hosts":[]}
返回数据 2
{"id":329859,"label":"test","login":"ca60d32539d1823defdsfds","password":"aedb27f5e9211111","balance":5368033729,"balance_format":"5 GB","threads":2000,"sticky_range":{"start":10000,"end":30000},"allowed_ips":["125.1.1.1","60.249.20.180"],"blocked":false,"pool_type":"datacenter","default_pool_parameters":{"countries":["us","jp","gb"],"cities":[""],"states":[""],"zipcodes":[],"asns":[],"exclude_countries":[],"exclude_asn":[],"anonymous_filter":false,"rotation_interval":11},"blocked_hosts":[]}
echo $response;这里怎么写才能达到以下效果
需要只保留 default_pool_parameters 得到以下格式
国家countries: us,jp,gb
城市cities:
州states:
邮编zipcodes:
ASN号asns:
旋转时间rotation_interval: 11
echo $response; 这里怎么写才能达到以上效果