Trouble downloading box.com files via PHP
Approx 2 years ago I wrote a PHP program that run daily and pulls small audio-clips file from a box.com account and emails the files as email attachments. This program has been working smoothly for approx 2 years and just recently broke. Now, when the attachment is sent, it is not playable as an audio file. If you try to open it with any media player, you get an error that the file is not playable.
I took some time today to look into this bug. I see that when I open the file in Notepad, I see an almost empty file, with a few digits at the start. For example, this file:
generates a file that contains only the digits:
6145253
Obviously, I can't play that with a media player.
Here is the PHP code that I have been using without trouble until recently:
$fileURL = "https://app.box.com/shared/static/eox58nirjaxm5g4vo5n088l76dudzum4.mp3"; header('Content-Type: audio/mp4'); copy($fileURL, "/home/alivein5/public_html/email-system/attachments/".$fileName);
I spent a long time on this and didn't get anywhere. Has anything changed recently? Should I be using box.com API functions instead of my own PHP code??
I would appreciate any support here.
Thank you,
NS
-
Hello
I used to code some PHP way back in versions 2 and 3. Has the function changed? I do see that the URL you provided is legitimate and working. Is the box page you're pulling the MP3s from your own box site - or someone else's? You may be better off with box APIs - I've not looked at them but I'm sure they can provide what you want.
Another idea would be to actually post this question on the developer board here
Good Luck!
-
Sorry for my slow response. I would recommend filing a support ticket to help debug this further.
Please sign in to leave a comment.
Comments
6 comments