Hello everyone, I just started having problems using the Bing Adcenter API with downloading reports in .zip format with fopen. There are no errors, so this is a bit frustrating. The file opens fine in a browser but not in the script. Please note that the file gets deleted after download, so it will produce a 404 error.
My code has been working for over a year, and I suspect that it's in the URL. I tested my code with a simple URL and did not have any issues. I am using PHP Version 5.3.27
Snippet of my code (the $reportDownloadUrl variable is automatically generated with the API, but I wanted to show the usage as well as syntax):
$reportDownloadUrl = "https://download.api.bingads.microsoft.com/ReportDownload/Download.aspx?q=3XL5uFR5BeF%2b1O9DOD6ZshdhvTn6vr9%2fUl9g9iXw3%2f%2f61Ly5IInt0O%2ba34CWMNxQBSV%2b4KolQhuTaalw3hZpvTcD3sq2uDDZw2c6a4Ud3%2f8V8OnlPwulQ29P3bbt9f2BpzQ5Ubcn%2bfH2oKfitYQsoj7R9o7dx%2fD6Bd2rmgwsRLbFLZiwz8NKh%2bcVjVEMKcPGFqcYDx%2fG9rxzeBTp00k3hcmnn2iGh2JnU2dyPCL%2fKxvKZzxZYKnjY7OztS2ONLZ68TCq1b%2fR7vWpr%2f8rkGxzSGEdBvK2adr5pFWw29HyrP0tmbE8jRRmgpbaH6SgNpJfmg%3d%3d"; if (!$reader = fopen($reportDownloadUrl, 'rb')){ throw new Exception("Failed to open URL " . $reportDownloadUrl . "."); }
I really appreciate your help, it's been over 3 hours for me trying to figure out why this isn't working.