Hi,

If i create an export view and select 'provide as file', i can visit the URL and the file will download in the browser.

Is there any way that the file can be saved on the server itself instead of being provided as a download in the browser?

I'm thinking in terms of a scheduled cron job that would run once a month for example, and save the file somewhere on the server, overwriting it each time it runs?

The reason i ask is because we have views data export setup as a feed which is fetched by Google merchant center, and for some reason in the past couple of months the feed is failing to import even though it worked fine before, however if I tick 'provide as file' and simply save the export as a .txt file and manually import it works fine. For some reason Google has suddenly decided it doesnt like fetching the feed directly from the site.

Google say it is because the feed is in CSV format and not TXT format, even though it is tab-separated as opposed to comma separated as required by their specification (maybe when the feed is accessed directly it sends some kind of headers or meta data saying it is a CSV file?), but as i said it was all working fine before so I'm at a loss as to why it has stopped working.

Any advice or pointers would be very much appreciated, cheers!

Comments

Problue Solutions’s picture

Title: Provide as file - store on server instead of browser dowbload? » Provide as file - store on server instead of browser download?
Problue Solutions’s picture

Turns out this was very simple, I just created a one line php script and called it via a cron job...

file_put_contents("Filename.txt", fopen("http://wwww.mysite.com/views-data-export-url", 'r'));

Then I just used that file URL for the google merchant center feed, and it works fine. Hope this helps anyone trying to do the same thing :)