I don’t know if you can use this in your setup, but I just recently found out how to upload and download files from a public share with curl. You can also mount it with WebDAV and perhaps use the files in your web server that way.
Where $sharetoken is the long string at the end of the share URL, $sharepwd is the share password, and {} is the file name. Use -T for upload and -o for download.