我想通过curl连接从url获取JSON数据。当我打开链接时:显示{“version”:“N/A”,“success”:true,“status”:true}。
现在,我想获得以上内容。通过curl从url获取JSON数据
到目前为止,我有使用此:
$loginUrl = 'http://update.protect-website.com/index.php?plugin=firewall&action=getVersion';
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL,$loginUrl);
$result=curl_exec($ch);
curl_close($ch);
var_dump(json_decode($result));
不过,我总是得到NULL,是否有人有想法是哪里不对?
此链接http://update.protect-website.com/?plugin=firewall&action=getVersion/显示一个WordPress页面:-) –
@MadraDavid笑,遗憾的错误,纠正它 –