Am trying to use twilio curl api
but am getting this error:
Error code: 400 Error Message: {"code": 21604, "message": "A 'To' phone number is required.", "more_info": "https://www.twilio.com/docs/errors/21604", "status": 400}here is the code
#!/usr/bin/perl use strict; use warnings; use LWP::UserAgent; print "Content-type: text/html\n\n"; my $ua = LWP::UserAgent->new; my $sid = "sid"; my $auth = "auth_token"; my $url = URI->new("https://api.twilio.com/2010-04-01/Accounts/$sid/Me +ssages.json"); $url->userinfo("$sid:$auth"); $url->query_form( 'To' => 'whatsapp:+2123456789', 'From' => 'whatsapp:+14155238886', 'Body' => 'hey test msg', ); print $url, "\n"; my $req = HTTP::Request->new(POST => $url); $req->header('Content-Type' => 'application/x-www-form-urlencoded'); my $resp = $ua->request($req); if ($resp->is_success) { print $resp->decoded_content; } else { print $resp->decoded_content; }
In reply to parsing curl api by frank1
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |