Gossamer Forum
Home : General : Perl Programming :

How do you send an ICQ Pager from a perl script?

(Page 1 of 2)
> >
Quote Reply
How do you send an ICQ Pager from a perl script?
i wanna write a script in perl so that you can goto the website and enter on your details and the details of the receiver and press submit, they will get an icq pager.

But, how do i code the string to send the pager? its a http:// address to send it, something like this, i cant remember exact address

i need to send this some how http://wwp.icq.pager/...6&message=sdfsdf sdf dfsdf&send=yes

how do i go coding this to send this pager?
Quote Reply
Re: [WoSkI] How do you send an ICQ Pager from a perl script? In reply to
A google search on Perl ICQ returns an infinite number of relevent results, and even lists a Perl module on CPAN that might be of interest:

http://search.cpan.org/...-0.16/lib/Net/ICQ.pm

- wil
Quote Reply
Re: [WoSkI] How do you send an ICQ Pager from a perl script? In reply to
It's pretty simple, just use something like LWP::UserAgent. The URL is:

http://wwp.icq.com/scripts/WWPMsg.dll

...and the parameters you need to pass along are:

subject
to
fromemail
from
body
Quote Reply
Re: [Paul] How do you send an ICQ Pager from a perl script? In reply to
i kept getting internal server errors with Wil's link so i gave up.

I tried Pauls, but is it something like this i need to do?

require LWP::UserAgent;
$ua = LWP::UserAgent->new; $request = HTTP::Request->new('GET', 'http://wwp.icq.com/scripts/WWPMsg.dll?to=123456&from=me&fromemail=me@here.com&subject=this&body=message'); $response = $ua->request($request); # or $response = $ua->request($request, '/tmp/sss');


cause i get internal errors with this as well.

Last edited by:

WoSkI: Mar 11, 2003, 4:57 AM
Quote Reply
Re: [Paul] How do you send an ICQ Pager from a perl script? In reply to
You get errors with loading the link or using the code? If it's loading the link, here's a synoposis:

Code:
use Net::ICQ;

$icq = Net::ICQ->new($uin, $password);
$icq->connect();

$icq->add_handler('SRV_SYS_DELIVERED_MESS', \&on_msg);

$params = {
'type' => 1,
'text' => 'Hello world',
'receiver_uin' => 1234
};
$icq->send_event('CMD_SEND_MESSAGE', $params);

$icq->start();

Now when you say "error" and "internal error", it would be far more helpful for us if you could post the actual error message and the more detailed error found in your error.log.

Hope thuis helps.

- wil
Quote Reply
Re: [WoSkI] How do you send an ICQ Pager from a perl script? In reply to
Try this:

Code:
#!/usr/bin/perl
#======================================
# Copyright Paul 2003.

use strict;
use LWP::UserAgent;
use HTTP::Request qw(GET);
main();

#======================================

sub main {
#-------------------------------------------------------------
# Quick example of ICQ pager.

my $ua = LWP::UserAgent->new( agent => 'Takeshi/1.0', timeout => 30 );
my $url = q|http://wwp.icq.com/scripts/WWPMsg.dll?to=123456&from=me&fromemail=me@here.com&subject=this&body=message|;
my $res = $ua->request( GET $url );
if ($res->is_success) {
print "Content-type: text/html\n\n";
print $res->content;
}
else {
print "Content-type: text/html\n\n";
print $rec->code;
}
}
Quote Reply
Re: [Paul] How do you send an ICQ Pager from a perl script? In reply to
i still get internal server error below.

ive copied the code exactly, attached is the code exactly how i have uploaded it and chmodded it to 755.

Im not very good at coding in perl, php is my stronger area, but this server i have to use it on only supports perl.

hope ive provided enough info this time as im stuck as damn dog, dunno why im getting internal server errors, ive tried 2 different servers and get the same result.

--------------------------------------------------------------------- Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, and inform them of the time the error occurred and anything you might have done that may have caused the error.

More information about this error may be available in the server error log

--------------------------------------------------------------------




I will add, i just looked at the server error log and found this, is there a workaround for this? seems the module aint installed.

Global symbol "$rec" requires explicit package name at icq.cgi line 20.
Execution of icq.cgi aborted due to compilation errors.
[Wed Mar 12 18:18:30 2003] [error] [client xxx.xxx.xxx.xxx] Premature end of script headers: /usr/local/psa/home/siteurl.com/cgi-bin/icq.cgi

Last edited by:

WoSkI: Mar 11, 2003, 11:19 PM
Quote Reply
Re: [WoSkI] How do you send an ICQ Pager from a perl script? In reply to
There's a typo. Change $rec->code to $res->code



----
Cheers,

Dan
Founder and CEO

LionsGate Creative
GoodPassRobot
Magelln
Quote Reply
Re: [dan] How do you send an ICQ Pager from a perl script? In reply to
nope, still get internal server error as listed above.
Quote Reply
Re: [WoSkI] How do you send an ICQ Pager from a perl script? In reply to
Put
Code:
use CGI::Carp qw/fatalsToBrowser/;
just after
Code:
use strict;
That will display the error message in the browser window.

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] How do you send an ICQ Pager from a perl script? In reply to
i get the error

Can't locate object method "GET" via package "http://wwp.icq.com/scripts/WWPMsg.dll?to=1234567&from=me&fromemail=me@here.com&subject=this&body=message" at icq.cgi line 14

or

Can't locate LWP/UserAgent.pm in @INC (@INC contains: /usr/local/nf/lib/perl5/5.6.1/i386-freebsd /usr/local/nf/lib/perl5/5.6.1 /usr/local/nf/lib/perl5/site_perl/5.6.1/i386-freebsd /usr/local/nf/lib/perl5/site_perl/5.6.1 /usr/local/nf/lib/perl5/site_perl .) at icq.cgi line 6.
BEGIN failed--compilation aborted at icq.cgi line 6


think server missing the module, is there a work around?

Last edited by:

WoSkI: Mar 12, 2003, 12:23 AM
Quote Reply
Re: [WoSkI] How do you send an ICQ Pager from a perl script? In reply to
Change
Code:
my $res = $ua->request( GET => $url );

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] How do you send an ICQ Pager from a perl script? In reply to
doing that brings me back to the internal server error
Quote Reply
Re: [WoSkI] How do you send an ICQ Pager from a perl script? In reply to
Code:
my $res = $ua->get( $url );

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] How do you send an ICQ Pager from a perl script? In reply to
internal error
Quote Reply
Re: [WoSkI] How do you send an ICQ Pager from a perl script? In reply to
It works here.

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] How do you send an ICQ Pager from a perl script? In reply to
woops i lied, page didnt refresh, i get



Can't locate object method "get" via package "LWP::UserAgent" at icq.cgi line 14
Quote Reply
Re: [WoSkI] How do you send an ICQ Pager from a perl script? In reply to
Sorry, also change:

use HTTP::Request qw(GET);

to:

use HTTP::Request::Common qw(GET);



----
Cheers,

Dan
Founder and CEO

LionsGate Creative
GoodPassRobot
Magelln
Quote Reply
Re: [dan] How do you send an ICQ Pager from a perl script? In reply to
still get



Can't locate object method "get" via package "LWP::UserAgent" at icq.cgi line 14
Quote Reply
Re: [WoSkI] How do you send an ICQ Pager from a perl script? In reply to
All I can say is that the following executes without error on our server (after 2 edits [in red] I posted were made to the original script by Paul):

Code:


#!/usr/bin/perl
#======================================
# Copyright Paul 2003.
use strict;
use LWP::UserAgent;
use HTTP::Request::Common qw(GET);
main();
#======================================
sub main {
#-------------------------------------------------------------
# Quick example of ICQ pager.
my $ua = LWP::UserAgent->new( agent => 'Takeshi/1.0', timeout => 30 );
my $url = q|http://wwp.icq.com/scripts/WWPMsg.dll?to=123456&from=me&fromemail=me@here.com&subject=this&body=message|;
my $res = $ua->request( GET $url );
if ($res->is_success) {
print "Content-type: text/html\n\n";
print $res->content;
}
else {
print "Content-type: text/html\n\n";
print $res->code;
}
}


Your problem appears server|module-related.

----
Cheers,

Dan
Founder and CEO

LionsGate Creative
GoodPassRobot
Magelln
Quote Reply
Re: [dan] How do you send an ICQ Pager from a perl script? In reply to
yes i agree, module related, probably missing seeing it says it cant find the 'get' thing.

Any workarounds to this or not? i doubt they will install the module
Quote Reply
Re: [WoSkI] How do you send an ICQ Pager from a perl script? In reply to
http://www.perldoc.com/...b/LWP/UserAgent.html

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] How do you send an ICQ Pager from a perl script? In reply to
yes, thats the module im missing, i cant install it myself can i? as they wont install it
Quote Reply
Re: [WoSkI] How do you send an ICQ Pager from a perl script? In reply to
You can install it yourself into your local home directory surely? Or even rip out the code and throw it into your own script or reference it as a library?

But if you're going to do this -- why are you using a roundabout method of using LWP module? Why not use the direct Net::ICQ module I first directed you to?

- wil
Quote Reply
Re: [Wil] How do you send an ICQ Pager from a perl script? In reply to
that icq module is not available. what do i do, rip the code out of the module and include it in my code or something? never done it before.
> >