partial success. Its difficult to correct errors inside strings.

https://api.****/**/*****/messages has to be quoted with '\' and so does api:key***** without which i get a HTTP 400 bad request. found this by checking the original curl string from the company.
when i use it with '' eg '\'api:key-123456etc1234\'' and '\'https://api.****/**/*****/messages\''
i get this message which seems quite documented on stack overflow
Protocol 'https not supported or disabled in libcurl
same for http as well.strange
Protocol 'http not supported or disabled in libcurl
i will try this on the server, maybe it might just work there.
1st update curl-config --protocols shows me that HTTP is supported on my m/c.
so i guess im still in the woods with quoting things in perl :D. thanks for the help sir.
ill find a way out.
2nd update. thanks its working for me. well its just a string thing i goofed up somewhere as revealed in libcurl documentation.ive changed the order of the URL around. For all practical purposes your code was spot on. The only thing i faced is the to name<name@email> for sender address was not being accepted and i actually passed a string there.
But this is just a start. I guess LWP or WWW::Curl will be the right approach i understand.thanks!
for funssake im putting up the working code here. But Loops code is 99.99%% accurate for my use i would say. I hope such situatiosn never arise where i need to take someone elses code :D. Thanks
use strict; use warnings; use Capture::Tiny qw/ capture /; my $message = "first line of text"; $message .= "\nsecond line of text"; my ($to_id, $subject) = qw(ron\@asdfasdf.cc testMessage); my @args = ( '-v', '-s', '--user',"api:key-123456", , 'https://api.XXX.net/v2/xxx.yyy.org/messages', ,'-F', "from='xxx yyy <postmaster\@xxx.yyy.org>", ,'-F', "to=ron\@xxx.cc", ,'-F', "subject=\'$subject\'", ,'-F', "text=\'$message\'"); my ($stdout,$stderr,$exit) = capture { system 'curl', @args; };

In reply to Re^2: Curl usage with Perl's system command by perlron
in thread Curl usage with Perl's system command by perlron

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.