Best way to expose text file

Hello, I am wondering what is the best way to expose a .txt or .md file created with nextcloud notes publicly, so I can reach it with a very basic PHP file_get_contents()?

If you really want to get the file with a normal PHP command, you can use a normal webservice on your Nextcloud host and access e.g. the file directly:


Alternatively, you can of course also share the file publicly and make it accessible via https://cloud.server.tld/s/****/download. Maye you can use PHP features to download the file and use it.

Maybe you can also use a Nextcloud API or WebDAV.

1 Like

Thank you for your quick answer. I didn’t know about /download this is exactly what I need. Thanks!

1 Like