skip to Main Content

my system uses a XML file generated by a URL and I need a script that every 30 minutes access that URL (https://www.shopfisio.com.br/feeds/teste-leo?download=true), and download the file to my server directory.

Can somebody help me how to do this?

2

Answers


  1. In a simple case you can use following code:

    <?php
    
        $xml = file_get_contents('https://www.shopfisio.com.br/feeds/teste-leo?download=true');
        file_put_contents('import.xml', $xml);
    

    For scheduling execution of your script you might use cron.

    Login or Signup to reply.
  2. You can create a cron job entry that run a script every 30 minutes. In the script you should use CURL, Or just use package like guzzle to create a request to the url and save the returning body into a file on your server by one of read&write like file_put_contents files functions in php, hope thats help you.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search