D
D
DmitryNs2019-03-21 15:04:13
FTP
DmitryNs, 2019-03-21 15:04:13

Copying xml file from url to ftp on schedule?

There is an xml file url on another server (just a link, no access). It is necessary to copy this file to itself on ftp according to the schedule. Tell me, please, is this possible? The site is on wordpress, so maybe there are suitable plugins?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Orkhan Hasanli, 2019-03-21
@azerphoenix

<?php
function downloadXML($file_url, $save_to)
{
    $content = file_get_contents($file_url);
    file_put_contents($save_to, $content);
}
// Yandex Metrika
downloadXML('https://example.com/file.xml', realpath("./xml") . '/file.xml');
?>

https://example.com/file.xmlreplace with the url of the file you need.
well, for repetition, set a CRON task in the hosting.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question