I am trying to post some basic xml via https post and I am having minor trouble. First I tried using LWP::UserAgent and it kept giving me errors when I tried to install the module so I gave up on that method. I then found a little tutorial on how to do with with curl:

#!/usr/bin/perl use URI::Escape; use IPC::Open2; my $post_url = "https://www.domain.com/cgi-bin/AcceptXML"; my $curl = "/usr/local/bin/curl"; my $curl_opt = "-H 'Content-Type: text/xml'"; my $basic_auth = ""; $post_url =~ s|://|://$basic_auth\@| if $basic_auth; open2(*README, *WRITEME, "$curl $curl_opt -d \@- $post_url 2>/dev/null +"); my $xml_out = qq[<?xml version="1.0" encoding="UTF-8"?> <SomeXml> <SomeData>1234</SomeData> <SomeOtherData>x=25%</SomeOtherData> <MoreData id="445A">Pink Elephants</MoreData> </SomeXml> ]; print WRITEME &uri_escape($xml_out); close WRITEME;
I run it with all my iformation and I dont get any kind of response back so I dont know if it went through or not. How can I get the response and just print it out to the console? It looks like it might be writting the reponse somewhere, just not sure where. Thanks.

In reply to HTTPS post with curl (RESOLVED) by bobdole

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.