문제

I couldn't able to access the Box file contents using PHP-CURL. I have tried accessing XML and JSON files, but I'm not getting any results. I have tried the following code:

$url = 'https://api.box.com/2.0/files/File_id/content';

$header = array('Authorization: Bearer '.$access_token);
$curl = curl_init();
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
curl_setopt($curl, CURLOPT_URL, $url);
echo $returndata = curl_exec($curl);

Please help me to find a solution for this.

도움이 되었습니까?

해결책

Worked fine when added the following code:

curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);

Hope it will help someone facing the same issue.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top