This is a great idea: http://trilogy.brynmawr.edu/trico/sys/sms.html
By going off the books it is possible to add some javascript to a typical III Catalogue and get a very neat 'Send to Cell Phone' feature. Going along with the suggestions on the page I modified the script (sms.pl) and changed it into PHP. I even added a tiny amount of statistical gathering. My thought is if this thing is very popular it might be worth creating more interesing options. Something along the lines of 'Send this to an email address' or 'Recommend this to a friend'. Anyway here is my version of sms.php:
<?php
/*
* send to cell phone feature
*
*
* Command line args:
* $provider, name of provider
* $number, number provided by patron
* $item, From Catalogue where item is located
* $title, From Catalogue, text version of title
*/
$from = "catalogue@school.ca";
// Service Providers in Canada
$providers = array (
'Bell' => "@txt.bell.ca",
'Fido' => "@Fido.ca",
'Koodo' => "@msg.koodomobile.com",
'Solo' => "@txt.bell.ca",
'Rogers' => "@pcs.rogers.com",
'Telus' => "@msg.telus.com",
'Virgin' => "@vmobile.ca", );
//Stats - Very Basic Form
$fh = fopen("count.txt",'r');
$inc = fgets($fh); fclose($fh);
$inc = (int)$inc + 1;
$fh = fopen ("count.txt", 'w');
fwrite($fh, (string)$inc); fclose($fh);
//Validate incoming number
if (!is_numeric($number)){
echo "alert('Invalid Phone Number, please try again');";
exit; }
//Create message
$to_addr = $number.$providers[$provider];
$subject = "From Catalogue";
$message = $title."\n".$item;
if (mail($to_addr,$subject,$message,"From:".$from )){
echo "alert('Message Sent');"; echo "clearsms()";
}
else {
echo "alert('Error Eccountered, please try again');";
echo "clearsms()";
exit;
} ?>
The only extra modification (besides modifying css.js) is to create a file called count.txt in the directory where this script will live. Add '1' to the first line of that file, save it, and then chmod it to 777. Everytime the script calls it will read that file, increment the number and then write it out again. Basic? Very, but I didn't want to get any database programming involved.