You should look at Dokuwiki's remote system:
https://www.dokuwiki.org/devel:xmlrpc
It has a set of functions which enable you to use php to post and retrieve files on a remote dokwiki server.
See also
https://www.dokuwiki.org/devel:xmlrpc:clients.
Also a number of plugins:
https://www.dokuwiki.org/plugins?plugintype=64#extension__table