#!/usr/local/bin/perl # # Script to send a text message to an Orange phone using the cgi # gateway on the Orange website (via Lynx) # # $Id: orange-msg,v 1.3 1998/09/18 12:53:36 john Exp $ # $service_url = "http://www.uk.orange.net/cgi-bin/register/sms.pl"; $lynx ="/usr/local/bin/lynx"; use Getopt::Std; ######################################################################## # Parse all options if (!getopts('a:n:u:p:m:q')) { print <; $message = join '', @message; } die "Null message" unless $message; ######################################################################## # Quote all parameters sent via the POST data $area = QuoteURL($area); $number = QuoteURL($number); $message = QuoteURL($message); # Use Lynx to send the POST query open (LYNX, "|$lynx '-auth=$user:$pass' -post_data $service_url 2>&1") or die "Can't open"; print LYNX "FRAMES=++&messagetype=$area&number=$number&message=$message&ORANGE=$quiet"; close LYNX; ######################################################################## # Function to quote reserved characters in URLs. Possibly a bit over-zealous sub QuoteURL { $_ = shift; s/([^a-zA-Z0-9$-_@.])/sprintf("%%%02x", unpack("c", $1))/ge; return $_; } sub UnquoteURL { $_ = shift; s/%(..)/pack("c",hex($1))/ge; return $_; }