This is the code that is sending the headers & content in 2 different packets.
I've also tried a different version using query_form() from the URI module. With that it is all send as a single packet, but the parameters are then part of the URI and not the content. Can someone confirm if query_form should only be used with GETs?
use HTTP::Request::Common;
use LWP::UserAgent;
$ua = LWP::UserAgent->new;
$ua->request(POST 'http://user:password@z.y.z.com/devicesave.asp',
Content_Type => 'application/x-www-form-urlencoded',
Referer => 'http://x.y.z.com/newdevice.asp?map=CHI.wu
+p',
Content => [
'map' => 'CHI.wup',
'CreateNewDevice' => 'true',
'Title' => 'node',
'HostName' => 'node.acme.com',
'IP' => '127.0.0.1',
'PollType' => 'ICMP',
'HostType' => 'Server',
'Info1' => 'info1',
'Info2' => 'info2',
'Snmp' => '1',
'ReadComm' => 'read',
'WriteComm' => 'write',
'OID' => '',
'Logging' => '1',
'Monitoring' => '1',
'StartTime' => '0000',
'EndTime' => '2400',
'Sun' => '1',
'Mon' => '1',
'Tues' => '1',
'Wedn' => '1',
'Thur' => '1',
'Fri' => '1',
'Sat' => '1',
'PollFreq' => '1',
'TimeOut' => '5000',
'DownDep' => '0',
'UpDep' => '0',
'Notes' => '',
'end' => 'end'
]
);
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.