获取请求Pandadoc API PHP

时间:2015-03-07 15:30:59

标签: php json curl get

我正在制作以下CURL GET请求有什么问题吗?

根据https://developers.pandadoc.com

我成功上传了一个pdf,因为JSON响应是

{"name": "PSA", "uuid": "b7dwPya77AURKB7Y8ZFnDh", "status": "document.uploaded", "date_created": "2015-03-07T14:42:59.863517Z", "date_modified": "2015-03-07T14:42:59.863517Z"}   

但是当我使用以下代码检索文档状态时 CURL请求在300秒后超时,导致无效

echo $ret = curl_exec($ch);
$response = json_decode($ret, true);

$uuid = $response['uuid'];

$url = "https://api.pandadoc.com/public/v1/documents/$uuid";
$headr = array();
$headr[] = 'Content-length: 0';
$headr[] = 'Content-Type: application/json;charset=UTF-8';
$headr[] = "Authorization: Bearer $ACCESS_TOKEN";

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER,$headr);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
curl_setopt($ch, CURLOPT_STDERR, $fp);

$ret = curl_exec($ch);

$response = json_decode($ret, true);

0 个答案:

没有答案