2017-04-18 12:27 阅读 82


I need to download file:///// and if I paste it in browser it will open up a word document. I am automating it with PHP script like this - shell_exec("wget file:///// -O /tmp/batch_test/final_remu.docx");

Obviously this doesn't work because file:///// is not a recognized.

In which format do I have to put it in shell_exec? `

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

  • 已采纳
    douzhenggui8171 douzhenggui8171 2017-04-18 17:23

    wget is a web client, it's really meant for HTTP requests. But this isn't an HTTP location, it's a file system location:


    (It may be a network-mounted file system, but that makes little different to PHP.)

    Instead of trying to "download" the file, just treat it like a file system operation and copy the file instead. Something like:

    copy("//", "/tmp/batch_test/final_remu.docx")

    (I'm somewhat guessing on the exact file location format of that first argument, I'm a little rusty on it. Hopefully this works as-is, but it may need a little tweaking.)

    点赞 评论 复制链接分享