View previous topic :: View next topic |
Author |
Message |
befortin Apprentice
Joined: 10 Feb 2004 Posts: 193
|
Posted: Fri Apr 30, 2004 1:23 pm Post subject: Send pager with provider's website |
|
|
Hi all!
I'm looking for a way to send messages to an alphanumeric pager through the provider's website (http://www.paging.mobility.com/). I can't page by mail, neither by modem because of the network's restrictions. Anyone knows a way to do this?
Thanks! |
|
Back to top |
|
|
flybynite l33t
Joined: 06 Dec 2002 Posts: 620
|
Posted: Fri Apr 30, 2004 10:56 pm Post subject: |
|
|
You can do this using the web interface. You could probably do this in perl , curl or lynx.
The idea is to submit the form with a script filling in the blanks.
Take a look at the source of the web page and look for the form that is submitted:
Code: |
<form name="deviceNum" onSubmit="return validateDeviceNum();" METHOD="POST" ACTION="/tnpp/imgGenIDSub" target="main">
<input type="hidden" name="TEMPLATE" value="/img/tnpp/general/outbox/submitMessage.html"><input
type="hidden" name="EXCEPTION_TEMPLATE" value="/img/tnpp/general/imgHtmlException.html"><input
type="hidden" name="DEVICE_TYPE" value="SMS"><div align="center">
|
There is more but I'm not going to post it all here. The keys are method=post, and input type/name/value pairs.
Here is an example from the perl cookbook, note that the web page has changed. http://www.perldoc.com/perl5.8.0/lib/lwpcook.html
Code: |
#! /usr/bin/perl
use LWP::UserAgent;
$ua = LWP::UserAgent->new;
my $req = HTTP::Request->new(POST => 'http://www.perl.com/cgi-bin/BugGlimpse');
$req->content_type('application/x-www-form-urlencoded');
$req->content('match=www&errors=0');
my $res = $ua->request($req);
print $res->as_string;
|
Notice how this code is for a POST and sets 'match'=www then submits the request.
I know this isn't easy but there are good examples on the web. |
|
Back to top |
|
|
befortin Apprentice
Joined: 10 Feb 2004 Posts: 193
|
Posted: Sat May 01, 2004 12:21 am Post subject: |
|
|
Thank you very much! I'll have a closer look at what you told me to check. |
|
Back to top |
|
|
kpack Tux's lil' helper
Joined: 29 Mar 2004 Posts: 137
|
Posted: Sat May 01, 2004 3:28 am Post subject: |
|
|
Here's a sample that works with a numeric pager at snpp.skytel.com (7777). I don't know if it's similar to an alphanumeric pager or not.
The code's a little kludgy, but it works
javascript:emoticon('')
The conversation looks something like this (it's designed to send the same message to multiple pagers):
220 Welcome
PAGE 12345
250 OK
MESS 5555551212
250 OK
SEND
250 oK
PAGE 23456
250 OK
...
...
Code: | sub send_page {
my ($host, $port, $call_list, $error_msg) = @_;
my $call_record;
my $dialog_record;
my $response;
$$error_msg = "Normal return";
my $socket = IO::Socket::INET->new(
PeerAddr => $host,
PeerPort => $port,
Proto => 'tcp');
if (! $socket) {
$$error_msg = "Can't create server socket: $!";
return 0;
}
$response = <$socket>;
chop($response);
chop($response);
if ($response !~ /220/) {
$$error_msg = "Received '$response' on connect - expected 220";
return 0;
}
foreach $call_record (@$call_list) {
my @dialog = (
"PAGE $$call_record{'pager_id'}",
"MESS $$call_record{'message'}",
"SEND"
);
foreach $dialog_record (@dialog) {
print $socket "$dialog_record\n";
$response = <$socket>;
chop($response);
chop($response);
if ($response !~ /250/) {
$$error_msg = "Received '$response' in response to '$dialog_record' - expected 250";
return 0;
}
}
}
return 1;
}
|
|
|
Back to top |
|
|
kpack Tux's lil' helper
Joined: 29 Mar 2004 Posts: 137
|
Posted: Sat May 01, 2004 3:32 am Post subject: |
|
|
I just read your post a little more carefully and noticed that you said you wanted to do it through a web page. My code sample uses the snpp protocol. Sorry about that. |
|
Back to top |
|
|
befortin Apprentice
Joined: 10 Feb 2004 Posts: 193
|
Posted: Sat May 01, 2004 12:02 pm Post subject: |
|
|
Actually this has to work on a very restricted network. It's a bank's network so the only ports that are open are outgoing HTTP, outgoing FTP and outgoing 8080! |
|
Back to top |
|
|
|