开发者

php file_get_contents ('....datafile.xml') - get the datafile from my local desktop?

I have a database that exports xmls only locally (to my computer). It will not export to a remote server.

I have a php fil开发者_StackOverflow中文版e (located on remote server) that sends the xml to a webserivce. Can I have the remote php file use "file_get_contents" function to extract xml data from my local computer?

If so, what is the proper syntax? Thanks in advance.


I think you should add a file upload page,upload the local xml file to remote server,the do the the next work.


You have a couple of options...

You could run a local web server on your computer and publish the files via that. Your remote PHP script could then read the file.

A potentially better alternative would be to use something like Dropbox. Save the database files in your Dropbox folder. They will be automatically uploaded to the Dropbox cloud storage.

Your remote PHP script could then retrieve them via the Dropbox API or if they are in the "public" folder, directly via URL.


You have to make your file available from your linux machine:

  • install a webserver on your desktop machine and allow it to expose the file, so the file will be available to an URI like http://ip_of_your_desktop/path_to_files/filename.xml (this was mentioned above also)
  • if your desktop and server are on the same network, share the folder on your desktop, mount the folder on your linux machine and use file_get_contens to read the file from the mounted location
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜