Using Curl to Prepare Email on Local Server
2006-07-05 15:25:53 GMT
I am using curl command line in a script that sends email to a distribution list. The script uses a simple form of curl to accomplish this:
Echo ‘header information for email’ >mailFileToSend
Curl http://www.raystedman.org/power/0705.php >>mailFileToSend
This sequence works well to expand the dynamic php content of 0705.php into straight html before sending the email. The script ran from crontab early this morning and yielded a mailFileToSend that had headers and no content. Perhaps there was a problem on the network or something. I saw this once before in manual testing as well. The script works well most of the time and sends the email off to the distribution list.
I need to make this script more robust. Two ideas come to mind:
(1) check the resulting file for </html> as the last line and retry curl if not
(2) the 0705.php file is local to the server. Is it possible to use curl without going off the server (without using the network) to accomplish this?
Thanks in advance! Greg