Converting the sample curl command to LWP::UserAgent using curl-to-lwp, I get the following:
#!perl use strict; use warnings; use LWP::UserAgent; my $ua = LWP::UserAgent->new( 'send_te' => '0' ); my $r = HTTP::Request->new( 'POST' => 'https://api.twilio.com/2010-04-01/Accounts/$TWILIO_ACCOUNT_SID/Messag +es.json', [ 'Accept' => '*/*', 'Authorization' => 'Basic JFRXSUxJT19BQ0NPVU5UX1NJRDokVFdJTElPX0FVVEhfVE9LRU4=' +, 'User-Agent' => 'curl/7.55.1', 'Content-Length' => '129', 'Content-Type' => 'application/x-www-form-urlencoded' ], "Body=This\x2520is\x2520the\x2520ship\x2520that\x2520made\x2520the\x25 +20Kessel\x2520Run\x2520in\x2520fourteen\x2520parsecs\x253F&From=\x252 +B15017122661&To=\x252B15558675310" ); my $res = $ua->request( $r, ); __END__ Created from curl command line curl -X POST https://api.twilio.com/2010-04-01/Accounts/$TWILIO_ACCOUN +T_SID/Messages.json --data-urlencode "Body=This is the ship that mad +e the Kessel Run in fourteen parsecs?" --data-urlencode "From=+15017 +122661" --data-urlencode "To=+15558675310" -u $TWILIO_ACCOUNT_SID:$ +TWILIO_AUTH_TOKEN
If the above works, but your code does not, I'm not really sure where/how To goes missing...
In reply to Re: parsing curl api
by Corion
in thread parsing curl api
by frank1
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |