所以我一直在试图找出如何管理这几天,但没有那么远,Sendgrid卷曲认证GET API
这里是我的问题:我试图检索JSON来自SendGrid GET API的对象。 - >https://api.sendgrid.com/v3/suppression/bounces/
这就需要卷曲认证,为支撑告诉我:
curl --request GET \
--url https://api.sendgrid.com/v3/suppression/bounces/
--header 'authorization: Bearer YOUR_API_KEY'
--header 'Content-Type: application/json'
所以,因为我是很新,卷曲,我不能设法与该检索DATAS:
$ch = curl_init('https://api.sendgrid.com/v3/suppression/bounces/');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json' , 'authorization: Bearer MY_API_KEY'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
$bounces = json_decode(file_get_contents($response),true);
我得到这个错误:
Warning: file_get_contents({"errors":[{"field":null,"message":"resource not found"}]}): failed to open stream: No such file or directory in ...
谢谢! :)
您是否尝试过: '$反弹= json_decode($响应,真正的);'? –
我终于通过了,谢谢 – naspy971