Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2018-08-06 15:09:06

element
Member
Registered: 2009-11-18
Posts: 99

Convert RSS feed to file and upload to ftp server

Is there a way to convert the RSS feed link to a file and upload that xml-file to another remote ftp server, daily?

Last edited by element (2018-08-06 15:11:51)

Offline

#2 2018-08-06 15:17:29

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,028
Website GitHub Mastodon Twitter

Re: Convert RSS feed to file and upload to ftp server

Not that I know of. Wouldn’t that mean duplicate content though?

One alternative option is to use rah_external_output and embed those results in another page with some simple php. If this is what you need, or if it is acceptable to you, please do tell us, and we can easily guide you through it.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#3 2018-08-06 15:33:11

element
Member
Registered: 2009-11-18
Posts: 99

Re: Convert RSS feed to file and upload to ftp server

Some one needs an xml-file to import TXP articles into their own system, ideally daily.

They will provide an ftp-address where I can drop that xml-file. So I need something that can convert the rss-link to an xml-file and upload that file daily and automatically to an ftp-address.

Last edited by element (2018-08-06 15:34:34)

Offline

#4 2018-08-06 15:47:59

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,609
Website

Re: Convert RSS feed to file and upload to ftp server

Maybe you – or your partner site – can do something like a cron-job that calls up the feed and writes it to an xml file at the defined time interval. If on your site, it would then ftp to the other site’s (presumably public) folder. If the cron-job runs on their server, you wouldn’t need to ftp it.


TXP Builders – finely-crafted code, design and txp

Offline

#5 2018-08-06 21:22:10

etc
Developer
Registered: 2010-11-11
Posts: 5,062
Website GitHub

Re: Convert RSS feed to file and upload to ftp server

element wrote #313290:

Some one needs an xml-file to import TXP articles into their own system, ideally daily.

They will provide an ftp-address where I can drop that xml-file. So I need something that can convert the rss-link to an xml-file and upload that file daily and automatically to an ftp-address.

RSS is already XML, so you probably just need to upload it as is. Untested, but I would create, say, an article with

<txp:php>
$rss = file_get_contents('your_rss_feed_url');

$file = 'data://text/plain;charset=UTF-8,' . $rss;
$remote_file = 'destination.xml';

// set up basic connection
$conn_id = ftp_connect($ftp_server);

// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);

// upload a file
ftp_put($conn_id, $remote_file, $file, FTP_ASCII);

// close the connection
ftp_close($conn_id);
</txp:php>

Then you could use, say, cron-job.org to ping this article daily.

Offline

Board footer

Powered by FluxBB