my $json = encode_json({ to => $nums, from => $sender, message => $msg, }); my $response = $ua->post($url, Content_Type => 'application/json', username => $username, password => $password, Content => $json, });