Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Curl usage with Perl's system command

by Your Mother (Archbishop)
on Oct 28, 2014 at 18:26 UTC ( [id://1105351]=note: print w/replies, xml ) Need Help??


in reply to Curl usage with Perl's system command

This worked fine, WWW::Mechanize, LWP::UserAgent, and JSON to handle the messages from the API. You will have to put in your own valid ids etc. The ones below are randomized/edited.

use strictures; use WWW::Mechanize; my $mech = WWW::Mechanize->new(); $mech->credentials( api => "key-da0f99505ece11e48064d6516832a126" ); $mech->post( "https://api.mailgun.net/v2/xyz.mailgun.org/messages", [ from => 'Mailgun Sandbox <postmaster@sandboxyz.mailgun. +org>', to => 'Kitty <fluffy@cats.co.uk.jp.org>', subject => 'OHAI', text => 'Congratulations! You are a winner. A loser no +more!!' ]); print $mech->response->as_string, $/;
{ "message": "Queued. Thank you.", "id": "<20141028181741.33218.21053@sandboxyz.mailgun.org>" }

First principles, I really recommend against cut and paste programming. You have to know what everything does or you might do something dangerous and you will certainly waste time treating each script as a mystical invocation.

I also think you should have included the real service and such in your original question to make it easier. Not that it was hard to find but if you want help, lowering the bar to do so is often the difference between an answer in 30 minutes and an answer never.

Replies are listed 'Best First'.
Re^2: Curl usage with Perl's system command
by perlron (Pilgrim) on Oct 28, 2014 at 18:35 UTC
    thanks ill check this. quite kind of you.
    i thought it would be against the rules n such to post company info.
    Do not wait to strike when the iron is hot! Make it hot by striking - WB Yeats

Log In?
Username:
Password:

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

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

    No recent polls found