Well, it's Lord Shryku's script, actually. I forget which thread we were in, and I've looked at 3 or 4 via the search page and not found it. He was apparently rather bored ... I was harping about how I should write a script; he actually did it.
I hacked it up a bit, it sends me a daily e-mail as to whether or not anyone's having a birthday. And, of course, scheduled it with cron and created an array of people to watch for ... it's edited to three here for brevity. (I thought the proxy support was nice, too, LordS, tho' I don't need it...)
<?php
// by Lord Shryku, from PHPBuilder. Notification of birthdays....
// Look for the following people's birthdays....
$watch = array('buzzly', 'elizabeth', 'planetsim');
// Email notification address. Set to FALSE for no mail...
$mailto="foo@foo.com";
$proxy = ''; # Proxy Server. Leave blank if you don't use $
$port = ''; # Proxy Port. Leave blank if you don't use a $
$found = array();
$page = 'http://phpbuilder.com/board/index.php';
if(empty($proxy) || empty($port)) {
$page = file_get_contents($page);
} else {
$data = fsockopen($proxy, $proxy);
if(!$data) {
echo "Cannot access ".$page;
}
else {
fputs($data, "GET $page HTTP/1.0\n\n");
$cont = '';
while(!feof($data)) {
$cont .= fread($data, 4096);
}
}
@fclose($data);
$page = substr($cont, strpos($cont, "\r\n\r\n") + 4);
}
$page = strstr($page, 'Birthdays:');
if(($end = strpos($page, '</td>')) !== false)
$page = substr($page, 0, $end);
if(!empty($page)) {
$users = explode("</a>", $page);
foreach($users as $u) {
if(eregi('userid=[0-9]', $u)) {
$found[] = trim(str_replace('>', '', substr($u, strrpos($u, '>'))));
}
}
}
if(count($found) > 0) {
$matches = array_intersect($watch, $found);
if(count($matches) > 0) {
$label = (count($matches) > 1) ? ' have birthdays' : ' has a birthday';
$label .= ' today!';
$msg="Your PHPBuilder friend(s), ".implode(', ', $matches).$label;
}
else {
$msg= 'No PHPBuilder friend birthdays today.';
}
}
else {
$msg= 'This script sucks. Could not find the birthdays';
}
if ($mailto) {
$success=mail($mailto, "PHPBuilder Birthday Watch", $msg);
} else {
echo $label;
}
?>
So, in my email this morning:
Your PHPBuilder friend, jebster, has a birthday today!