Page 1 of 1
Download pdf using php
Posted: Wed Feb 16, 2011 2:26 am
by nithinkk
I got a set of newspaper websites which allows me to download epaper on-line. Is it possible to download them using php scrip to a particular folder at 12pm everyday.
Example websites :
http://epaper.mathrubhumi.com/index.php ... /index.asp
Re: Download pdf using php
Posted: Wed Feb 16, 2011 4:48 am
by gooney0
Sure. You could go about this many ways:
1) Use cron and commandline php
2) Use cron and wget don't use php at all. This is easier I think.
3) Use regular PHP and have something visit the web script at midnight.
In PHP you can use fopen, fread, and fwrite to handle the HTML and PDFs.
From your example it looks like you'll need to:
fopen the URL
parse out the link(s) to the pdf
fopen the PDF url
fwrite the PDF to a file
Re: Download pdf using php
Posted: Wed Feb 16, 2011 6:37 am
by nithinkk
Thanks ! i did it with Cron job + Bash script