Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Call URL

by dmsparts (Sexton)
on Nov 07, 2008 at 11:10 UTC ( [id://722199]=perlquestion: print w/replies, xml ) Need Help??

dmsparts has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I am trying to make a script call a url that sends text messages. here is what i have to call,
http://www.intellisoftware.co.uk/smsgateway/sendmsg.aspx?username=xxx& +password=xxx&to=12345678&text=this%20is%20my%20text&sender=me
where all the string elements are set as variables in the script below.
if ($form{'ASSMS'} eq "Yes") { $ring = "0"; $smsdate = $Day.$monnm.$yearx; $smslogtitle = $smsdate; $smstitlea = $form{'DESTINY'}; $smstitleb = "44"; $smstitled = substr($smstitlea, 1, 10); $smstitle = $smstitleb.$smstitled.$smstitlec; $smsuser = "xxx"; $smspass = "xxx"; $smsto = $smstitleb.$smstitled; $smssender = "DMSTEST"; $smsmsg = "$form{'DESC'} Ref: $form{'REQREF'}"; $smsmax = "3"; $smsmsg =~ s/\ /%20/g; $smsurl = "http://www.intellisoftware.co.uk/smsgateway/sendmsg.aspx?us +ername=$smsuser&password=$smspass&to=$smsto&from=$smssender&text=$sms +msg&maxconcat=$smsmax"; NEED TO CALL URL HERE $adtitle = $form{'FILEBIT'}; &oops('Cannot write') unless (open(NEWITEM, ">>$basepath/Parts/$adtitl +e.dat")); print NEWITEM "\n$form{'TSTAMP'}-$form{'initials'}-SMS-$form{'DESC'}"; close NEWITEM; $izsent = 1 ; open(NEWITEM, ">>$smslog/$smslogtitle.dat"); print NEWITEM "\n$Hour:$Minute-$form{'DESTINY'}-$form{'REQREF'}-$form{'DESC'}"; close NEWITEM; print $smsurl; print <<"EOF"; <p align="center"><font face="Verdana">Your text message has been logg +ed and sent !</p> EOF }
the script works in that I can get it to print on screen the exact url i need, but i am not sure how to make the script call that url in IE. Any Help would be appreciated. Cheers Michael

Replies are listed 'Best First'.
Re: Call URL
by marto (Cardinal) on Nov 07, 2008 at 11:48 UTC
      HI, to be honest. i don't need to to be called through IE but that is the only way i have managed to get it to work. If there is a way of calling it in the script that would be better. Im not sure of the exact command though. Cheers
Re: Call URL
by f00li5h (Chaplain) on Nov 07, 2008 at 13:18 UTC

    You could LWP::Simple... Although you don't get HTTP response codes, so you'd have to check the page sent back for something to indicate success...

    use LWP::Simple; get($smsurl);

    @_=qw; ask f00li5h to appear and remain for a moment of pretend better than a lifetime;;s;;@_[map hex,split'',B204316D8C2A4516DE];;y/05/os/&print;

      so you'd have to check the page sent back for something to indicate success...

      It's easier just using LWP::UserAgent.

      use LWP::UserAgent; my $response = LWP::UserAgent->new()->get($smsurl); die if !$response->is_success;

        quoth LWP::Simple::get

        The get() function will fetch the document identified by the given URL and return it. It returns undef if it fails.

        @_=qw; ask f00li5h to appear and remain for a moment of pretend better than a lifetime;;s;;@_[map hex,split'',B204316D8C2A4516DE];;y/05/os/&print;

Re: Call URL
by ikegami (Patriarch) on Nov 07, 2008 at 20:50 UTC
    There's a notable lack of URI::Escape in building the URL.
Re: Call URL
by crusher (Acolyte) on Nov 07, 2008 at 20:02 UTC
    use the 'system' or 'exec' function in perl to launch internet explorer...
    The following syntax should work: system("iexplore $url");

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://722199]
Approved by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (2)
As of 2024-04-25 19:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found