- 論壇徽章:
- 0
|
本帖最后由 ykredrum 于 2010-03-13 23:00 編輯
想用個(gè)小程序,由電腦控制手機(jī)發(fā)短信,以前在論壇上找到過例子,稍微改了下
手機(jī):Nokia 6300
——————————————————————————————————————————————
代碼如下:
use strict;
use Device::Gsm;
my $pin = '0000';
my $gsm = new Device::Gsm( port => 'COM4', pin => $pin,log => 'file,send.log' );
die "cannot create Device::Gsm object!" unless $gsm;
$gsm->connect( baudrate => 19200 ) or die "cannot connect to GSM device on [COM4\]\n";
$gsm->register() or die "cannot register on GSM network: check pin and/or network signal!";
print "\nok! connected and registered to network.\n";
my $lOk = $gsm->send_sms(
content => 'hello world' ,
recipient => 'xxxxxxxxx', #接收短息的手機(jī)號碼
status_report=>1,
);
if($lOk){
print "successful!/n";
}else{
print "failed!/n";
}
————————————————————————————————————————————
程序運(yùn)行后出現(xiàn)錯(cuò)誤,具體如下:
E:\>perl yk.pl
Missing REQUIRED setting for BAUD at D:/strawberry/perl/site/lib/Device/Modem.pm
line 506
write_settings failed, closing port at D:/strawberry/perl/site/lib/Device/Modem.
pm line 506
Missing REQUIRED setting for BAUD at D:/strawberry/perl/site/lib/Device/Modem.pm
line 506
write_settings failed, closing port at D:/strawberry/perl/site/lib/Device/Modem.
pm line 506
cannot register on GSM network: check pin and/or network signal! at yk.pl line 1
4.
————————————————————————————————————————————
以前用天語的手機(jī)發(fā)送成功過,手機(jī)換了后就出現(xiàn)錯(cuò)誤了
不知道怎么回事我設(shè)置了 baudrate => 19200
錯(cuò)誤一直說我沒有設(shè)置。
請哥哥姐姐幫幫忙!謝謝了先 |
|