下载文件框时出现错误 302 api

Error 302 in downloading files Box api

Helo 我正在为 Box API 开发。我正在尝试下载文件。 我已经转储文件并且它已经有一个正确的 url。 但它只会显示这个

string 'HTTP/1.1 302 Found
Server: ATS
Date: Fri, 13 Mar 2015 14:41:22 GMT
Content-Length: 0
Cache-Control: no-cache, no-store
Location: https://dl.boxcloud.com/bc/4/3e0b9dd52bc17a1edaf1c263ec613202/o-EWhPXtuelO1i_6OmSS5hOgZg0uBzXTykrrTg_ayh0ZRcRIBB15yPlDHRoYjfVRpA4Ub1dxWSCzF0pTMPVbpGD2tLBCJQF8IHoOEigMbQUIrV4C5-u-ZhJzP6uAgZxDfliI3F_Vp0WxBvjIUuKFP9wqTFJLxQHpGqA9yMH_w9-MpTQzBszWjTD9AxFyamT5MxKVDu3ak3ShkzA1xDGMiOLxMPe599zxAt_e8kuNN0stjxgQwSFsVuSR8xrqMp4VTQ9MHK4Gc2qru1zJaZy804JWGhgGUTyb6ncoG3jIrknjzh8ccM9wiKmJZKWq'... (length=1521)

它是一个空白的空白,有这个错误。请帮助。提前谢谢你

Box 将您重定向到 URL,您可以从中下载文件内容。这是预期的行为。来自 Box API documentation:

If the file is available to be downloaded, the response will be a 302 Found to a URL at dl.boxcloud.com. The dl.boxcloud.com URL is not persistent. Clients will need to follow the redirect in order to actually download the file. The raw data of the file is returned unless the file ID is invalid or the user does not have access to it.

更新

您可以使用 -L 选项指示 cURL 自动跟随重定向(see also). And here's a solution for PHP