سؤال

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