Hi
Ok I am making progress here but I am stuck again
Belowe is what i have come up with and it works fine doing just want i want it to do.
- sub send_other
-
{
-
my $dest = shift;
-
my $msg = shift;
-
-
-
# start a new sms message
-
-
use LWP::UserAgent;
-
use HTTP::Request::Common;
-
use URI::Escape;
-
-
# format sms message
-
-
$post_data = ();
-
$post_data{'sdn'} = "+447781100000";
-
$post_data{'message'} = " this is my messsage !";
-
$post_type = "http://";
-
@post_servers = ("me.me.com", "me.me.com",
-
"me.me.com", "me.me.com");
-
$post_path = "/sms1.php";
-
my $ua = LWP::UserAgent->new(agent => 'dxg perl client');
-
foreach $server (@post_servers) {
-
my $resp = $ua->request(
-
POST $post_type.$server.$post_path,
-
Content_Type => 'form-data',
-
Content => [ %post_data ]
-
);
-
if ($resp->is_success) {
-
print $resp->content;
-
last;
-
} else {
-
print "Error: ".$post_type.$server.$post_path." -
-
".$resp->status
-
print "Error: ".$post_type.$server.$post_path." -
-
".$resp->status_line."\n";
-
}
-
}
-
}
-
Now when I put this section of perl into the main script and runit i get the following messages and don't understand why
Global symbol "$post_data" requires explicit package name at DXGateway.pl line 1521.
Global symbol "%post_data" requires explicit package name at DXGateway.pl line 1522.
Global symbol "%post_data" requires explicit package name at DXGateway.pl line 1523.
Global symbol "$post_type" requires explicit package name at DXGateway.pl line 1524.
Global symbol "@post_servers" requires explicit package name at DXGateway.pl line 1525.
Global symbol "$post_path" requires explicit package name at DXGateway.pl line 1527.
Global symbol "$server" requires explicit package name at DXGateway.pl line 1529.
Global symbol "@post_servers" requires explicit package name at DXGateway.pl line 1529.
Global symbol "$post_type" requires explicit package name at DXGateway.pl line 1531.
Global symbol "$server" requires explicit package name at DXGateway.pl line 1531.
Global symbol "$post_path" requires explicit package name at DXGateway.pl line 1531.
Global symbol "%post_data" requires explicit package name at DXGateway.pl line 1533.
Global symbol "$post_type" requires explicit package name at DXGateway.pl line 1539.
Global symbol "$server" requires explicit package name at DXGateway.pl line 1539.
Global symbol "$post_path" requires explicit package name at DXGateway.pl line 1539.
syntax error at DXGateway.pl line 1541, near "->status
why if it runs stand alone does it now give so many errors
Any thoughts?
Many thanks
Keith