Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Perl and form post help

Status
Not open for further replies.

Buddyholly83

IS-IT--Management
Aug 7, 2005
23
GB
I need to use Form Post interface to integrate SMS functionality into my site. I am accessing an SMS service through another company. All services are accessible using the HTTPS protocol.
Can someone please point me in the right direction for what i need to do for this?
They give tips on how to access ther services using PHP but not Perl. The PHP help involves using OpenSSL and cURL, I understand the openSSL is required to secure the connection but why is cURL needed?

Thanks :)
 
For cURL, read LWP.

This allows your perl script to interact with the webserver, so you can send requests etc etc

I'm not sure LWP::Simple might be enough
Code:
sub send_data {
  use LWP::UserAgent;
  $ua = LWP::UserAgent->new;
     
  $content_string= "user=$user&barcode=$delivery_id&account_number=$account_number&message=$message"

open FH2, ">>requests.dat";
print FH2 "$content_string\n";
close FH2;
  my $req = HTTP::Request->new(POST => '[URL unfurl="true"]http://www.smsprovidersite.com/cgi-bin/script.pl');[/URL]
  $req->content_type('application/x-[URL unfurl="true"]www-form-urlencoded');[/URL]
  $req->content($content_string);
  my $res = $ua->request($req);
  $rc= $res->as_string;
  if ($rc=/^HTTP\/1.1 200 OK/) {
    print "<h3>message $delivery_id delivered to server</h3>\n";
  }
}

cigless ...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top