CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Capture HTTP request using Perl?

 



wideback
New User

Jul 9, 2007, 6:21 AM

Post #1 of 6 (592 views)
Capture HTTP request using Perl? Can't Post

I want to capture the body of an HTTP request using Perl 5.6. The HTTP request will call my script, once it does I want to capture the body of the HTTP request. Are there any modules that will allow me to do this quickly?



Thanks


KevinR
Veteran


Jul 9, 2007, 9:24 AM

Post #2 of 6 (591 views)
Re: [wideback] Capture HTTP request using Perl? [In reply to] Can't Post

What do you mean by "the body of the HTTP request"?
-------------------------------------------------


wideback
New User

Jul 9, 2007, 9:49 AM

Post #3 of 6 (590 views)
Re: [KevinR] Capture HTTP request using Perl? [In reply to] Can't Post

An xml document will be embedded in the actual body of the request. When the script is activated I want to grab the body, similar to processing post/get variables except I want to get the HTTP body.


(This post was edited by wideback on Jul 9, 2007, 10:11 AM)


KevinR
Veteran


Jul 9, 2007, 10:35 AM

Post #4 of 6 (584 views)
Re: [wideback] Capture HTTP request using Perl? [In reply to] Can't Post

I don't understand what you are wanting to do. If nobody else here replies, try www.perlmonks.com or the perl forum at www.tek-tips.com or www.devshed.com
-------------------------------------------------


wideback
New User

Jul 9, 2007, 12:03 PM

Post #5 of 6 (579 views)
Re: [KevinR] Capture HTTP request using Perl? [In reply to] Can't Post

I'm going to restate my question (in case someone else takes a look).

I have a client using ajax and a server running apache/perl. At some point the client creates an HTTP post request to the server (URL pointing to http://server-address/cgi-bin/my_script.pl) with an xml document in the body of the request. With "my_script.pl" I want to read the xml document.



How can I do this?


(This post was edited by wideback on Jul 9, 2007, 12:04 PM)


wideback
New User

Jul 10, 2007, 5:54 AM

Post #6 of 6 (562 views)
Re: [wideback] Capture HTTP request using Perl? [In reply to] Can't Post

I've figured it out. The variable 'POSTDATA' found withing the HTTP request contains the body of the HTTP message. It can be accessed in the same way as reading fields from a post form.

ie:

use CGI qw (:standard);

foreach $p in param(){

if($p eq "POSTDATA"){

print "" . param($p) . "\n";

}

}



Thanks for taking a look KevinR

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives