如何使用JSON进行get调用并检索数据


how to make a get call with JSON and retrieve data

我正试图遵循RFC规范的说明,从"证书透明度日志"中检索数据;已知日志

说明说要做一个JSON调用,但我似乎没有任何成功…我实际上根本没有得到任何数据响应。

这是我试图遵循的指南:https://www.rfc-editor.org/rfc/rfc6962部分- 4.6

下面是我使用的php代码

<?php
$data = array("start" => "1", "end" => "10");                                                                    
$data_string = json_encode($data);                                                                                   
                                                                                                                     
$ch = curl_init('https://ct.googleapis.com/pilot/ct/v1/get-entries');                                                                      
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");                                                                     
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);                                                                  
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);                                                                      
curl_setopt($ch, CURLOPT_HTTPHEADER, array(                                                                          
    'Content-Type: application/json',                                                                                
    'Content-Length: ' . strlen($data_string))                                                                       
);                                                                                                                   
                                                                                                                     
$result = curl_exec($ch);
var_dump(json_decode($result, true));
?>

我连接的服务安装了SSL证书,但没有响应我的请求。禁用信任验证是解决方案。我将此添加到CURL选项CURLOPT_SSL_VERIFYPEER => false