I didn't understand what you told me about the content/headers stuff.
That's why I pointed out the distinction between data conveyed in the header and data conveyed in the content/body. IF you want to mimic the form submission, you must not transfer the data in the header - no browser does that! Perhaps, the csrf_token might need to be transferred with the header but that is surely defined in the fine API documentation, right?

I GUESS, you need something like this:

#-- everything from the FORM here (nerver use colons here): my@form_fields= ( csrf_token => $csrf_token, #-- above looks right, according to form example subscribees => "$name <$email +>", setmemberopts_btn => 'Submit Your C +hanges', send_notifications_to_list_owner" => "1" ); #-- read the API-doc: IF the csrf_token is required in the header # (use colons to prevent canonicalisation): my @headers = ( ':csrf_token' => $csrf_token, ':member_verbosity_threshold' => 0, 'User-Agent' => 'Mozilla/5.0' ); my $res = $ua->request(POST $_[0], @headers, Content => \@form_fields );
Regarding the lifetime expiration: Of course, you must provide the currently valid csrf_token. I hope, running this application is in accordance with laws and terms of use...


In reply to Re^5: POST fieldnames with underscores by Perlbotics
in thread POST fieldnames with underscores by BernieC

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.