I need some help adding HTTP Post to an existing code. Need to add the following code: POST /cbridge/xmlhost HTTP/1.1 HOST: 127.0.0.1 Content- length: 357

#!/usr/bin/perl use strict; use IO::Socket; use DBI; use DBD::Oracle; our (@command, $command); our ($socket_success_fl); our $svcpk; my $cable_command; ##$cable_command = ' ##<Transaction id = "12345" wait="1" priority="1"> ##<AddUpdateLocation> ##<LocationId> 8002721493 </LocationId> ##<HeadendCode> 01 </HeadendCode> ##<Address1> 19 Bow Circle </Address1> ##<Address2> Bow Circle Business Ctr Unit 402 </Address2> ##<City> Hilton Head Island</City> ##<State> SC </State> ##<Zip> 29926 </Zip> ##</AddUpdateLocation> ##</Transaction>'; ####$cable_command = $ARGV[0] #### or die "Could not find an argument \n"; print "$cable_command\n"; $socket_success_fl = 'N'; socket_connect(); if ($socket_success_fl =~ /Y/){ process_command(); socket_close(); }elsif ($socket_success_fl =~ /N/){ print "Unable to connect to socket!!....\n"; } sub socket_connect { socket (SH, PF_INET, SOCK_STREAM, getprotobyname('tcp')) || die $! +; my $dest = sockaddr_in (22928, inet_aton('172.17.15.102')); connect (SH, $dest) || die $!; $socket_success_fl = 'Y'; print "Connected to socket\n"; } sub process_command { my $v_param; my $buffer; $v_param = $cable_command; @command = split(/&/,$v_param); foreach $command (@command) { print "$command\n"; if ($command =~ /SVCPK=/ ) { $svcpk = substr($command,6,10); print "svcpk = ", $svcpk, " \n"; } else { print "About to send command\n"; send (SH, "$command\r", 0); print "sent command\n"; print "about to read response buffer\n"; sysread (SH, $buffer, 1000); print "read response buffer\n"; print "response = ", $buffer, " \n"; } } } sub socket_close{ close(SH); print "Socket closed \n";

In reply to Add HTTP Post For Socket Connection by randallc59

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.