Thanks Monks, I think I got it. An HTTP POST sends data to a program on the other end (POST and EXECUTE). In my case I had PHP take the hand off. So in PHP-land the HTTP POST shows up as an Array of values delivered in $_POST. The PHP program takes it from there (array of passed values) and if coded it can write to a file or anything php can do. My Perl send off below:
my $req = new HTTP::Request 'POST','http://foobar.com/stuff/post.php';
$req->content_type('application/x-www-form-urlencoded');
my $text = "rambling text message here for future use, Dave can hear me. ";
my $user = "yourusernamehere";
my $pass = "yourpasswordhere";
my $number = "44.55";
$req->content("user=" . $user . "&pass=" . $pass . "&text=" . $text . "&number=" . $number);
my $res = $ua->request($req);
print $res->as_string;
So basically I had two misconceptions:
1) that POST could just write directly to a remote .txt file.
2) something else that escaped me at first is that echo and print statements at the server within the remote (php) program are returned to sender. I had the view that POST was sort of one way comms. But it's more POST-EXECUTE-REPLY.
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.