Jump to content

HTTP POST to PHP


kansaschuck

Recommended Posts

Hello all.

 

 

I'm stuck on what I would think would be a very simple subject.  So most likely there is some simple concept I'm not understanding. 

 

I have a program that is issuing a HTTP POST (on laptop)to a my website(ISP).  On the website I understand that I need to build a  program that execute and captures that data from the POST (I'd like to do it in PHP) . 

 

On the internet I'm finding plenty of examples of how to POST.  Hundreds of them.  But finding a good example of how to capture the data I'm not finding.  I'm looking for information on options, parms, examples for the receiving PHP program. 

 

So maybe I don't know what it is called and I'm searching wrong, or maybe there are few because nobody does it that way. 

 

I do see examples of POST to forms.  I don't think that's what I want (I could be wrong).  Currently I was looking to capture, (via the PHP program), the data from a simple little Perl program listed below. This is the Laptop program that is issuing the post.  I'm looking to develop the code for the PHP program at receiving HTTP server (my website).

 

 

 

 

 use LWP::UserAgent;
  my $ua = new LWP::UserAgent;

  my $req = new HTTP::Request 'POST','http://mysite.com/x.php';
  $req->content_type('application/x-www-form-urlencoded');
  $req->content('What are you doing, Dave?');

  my $res = $ua->request($req);
  print $res->as_string;

 

Link to comment
Share on other sites

"the data from a simple little Perl program listed below."  :)

 

Perl (shown above) is POSTing to (a future) PHP program.

 

From what I've learned in my research since I've opened this question is since I may not understand the sending of data in the 'Content' area.  How the data is packaged up on one end for PHP to extract on the other.

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.