note 42322 deleted from function.getopt by philip
| From: | philip@php.net | Date: | Thu, 07 May 2009 22:32:06 +0000 |
| Subject: | note 42322 deleted from function.getopt by philip | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-154332@lists.php.net to get a copy of this message | ||
Note Submitter: vedanta at maintec dot com
----
A sample use :
#!/usr/bin/php
<?php
$opt = getopt("s:f:r:u:");
$help="***Error :url_mailer.php -s <subject> -f <sender_email> -r
<receipient_email> -u <url_to_mail>";
if($opt[s]=='' || $opt[r]=='' || $opt[u]=='' || $opt[f]==''
){ echo "$help\n";exit(); }
# prepare the mail message from the url
$url=trim($opt[u]);
$message=file_get_contents($url);
# prepare mail headers
$headers = "MIME-Version: 1.0\r\n";
$headers.= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers.= "From: $opt[f] \r\n";
# send the mail
mail($opt[r],$opt[s],$message,$headers);
?>