开发者

How do I use PHP to download a doc file?

I know that there are php functions that allow a user to download or you to download file using PHP BUT I have not seen a single one that allows your php file to navigate and download a file and store it in a specific directory..

So here is what I want to do. I have a web host which runs php applications. Then I have a website with a calendar. The calendar has options on the side...

Tools--->export as doc

I want to write a PHP code that EVERYDAY automatically goes to calendar's Tool options, then downloads the calendar called Team Calendar into the webhost where the script can use it. For experimental purposes lets assume the calendar URL is at http://webdesign.about.com/od/php/ht How do I go about this?

Thanks a bunch

EDIT: I TRIED WGET THIS IS WHAT I GOT, HOW CAN I MAKE IT DOWNLOAD THE FILE IN DOC FROM TOOLS?

[/cygdrive/c/documents and settings/omar.khawaja]$ wget http://confluence.com/display/prodsupport/Team+Calendar
--2011-06-02 16:33:43--  http://confluence.rogersdigitalmedia.com/display/prodsupport/Team+Calendar
Resolving confluence.com... 204.225.248.160
Connecting to confluence.com|204.225.248.160|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: http://confluence.com/login.action;jsessionid=2F13926CF763FE4F3862FAFC24AB81D7?os_destinati
on=%2Fdisplay%2Fprodsupport%2FTeam%2BCalendar [following]
--2011-06-02 16:33:43--  http://confluence.com/login.action;jsessionid=2F13926CF763FE4F3862FAFC24AB81
D7?os_destination=%2Fdisplay%2Fprodsupport%2FTeam%2BCalendar
Connecting to confluence.com|204.225.248.160|:80... connecte开发者_开发知识库d.
HTTP request sent, awaiting response... 200 OK
Length: 7865 (7.7K) [text/html]
Saving to: `login.action;jsessionid=2F13926CF763FE4F3862FAFC24AB81D7@os_destination=%2Fdisplay%2Fprodsupport%2FTeam+Cale
ndar'

100%[==============================================================================>] 7,865       --.-K/s   in 0.04s

2011-06-02 16:33:43 (207 KB/s) - `login.action;jsessionid=2F13926CF763FE4F3862FAFC24AB81D7@os_destination=%2Fdisplay%2Fp
rodsupport%2FTeam+Calendar' saved [7865/7865]

How do I use PHP to download a doc file?


You need to use a cron job on the server to do this. Have that cron job call a PHP script that simply saves the doc to a directory on the web server.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜