how to postback to a different URL than the one making the request?

how to postback to a different URL than the one making the request?

am 31.05.2007 22:32:26 von gvidals

I'm writing an XML function that will listen for requests for data and
then respond with the data. Simple enough; however, the data needs to
be sent to the URL specified in the request. For example, the
resultant data may needed by www.123.com one time and www.abc.com
another time.

I use LWP all the time for requesting web pages, but can somebody
provide some guidance as to how LWP can be used to send data? I'm
confused.

Thanks!

RE: how to postback to a different URL than the one making the request?

RE: how to postback to a different URL than the one making the request?

am 01.06.2007 01:00:36 von ted.behling

Hi,

To get a useful answer, you're going to have to break down your problem
a bit more clearly. LWP has nothing to do with XML, specifically. All
it does it make HTTP requests (usually GET or POST). When you say "send
data", are you talking about making a POST request, or replying to an
incoming request? The latter would not use LWP at all. If you were to
perhaps reply with a list of the exact steps required by your algorithm,
we could probably point you in the right direction.

Ted Behling

-----Original Message-----
From: vidals [mailto:gvidals@gmail.com]=20
Sent: Thursday, May 31, 2007 4:32 PM
To: libwww@perl.org; perl-libwww@moderators.isc.org
Subject: how to postback to a different URL than the one making the
request?

I'm writing an XML function that will listen for requests for data and
then respond with the data. Simple enough; however, the data needs to be
sent to the URL specified in the request. For example, the resultant
data may needed by www.123.com one time and www.abc.com another time.

I use LWP all the time for requesting web pages, but can somebody
provide some guidance as to how LWP can be used to send data? I'm
confused.

Thanks!

RE: how to postback to a different URL than the one making the request?

Re: how to postback to a different URL than the one making the request?

am 01.06.2007 02:49:25 von gvidals

On May 31, 4:00 pm, ted.behl...@htc.hargray.com (Ted Behling) wrote:
> Hi,
>
> To get a useful answer, you're going to have to break down your problem
> a bit more clearly. LWP has nothing to do with XML, specifically. All
> it does it make HTTP requests (usually GET or POST). When you say "send
> data", are you talking about making a POST request, or replying to an
> incoming request? The latter would not use LWP at all. If you were to
> perhaps reply with a list of the exact steps required by your algorithm,
> we could probably point you in the right direction.
>
> Ted Behling
>
> -----Original Message-----
> From: vidals [mailto:gvid...@gmail.com]
> Sent: Thursday, May 31, 2007 4:32 PM
> To: lib...@perl.org; perl-lib...@moderators.isc.org
> Subject: how to postback to a different URL than the one making the
>
> request?
>
> I'm writing an XML function that will listen for requests for data and
> then respond with the data. Simple enough; however, the data needs to be
> sent to the URL specified in the request. For example, the resultant
> data may needed bywww.123.comone time andwww.abc.comanother time.
>
> I use LWP all the time for requesting web pages, but can somebody
> provide some guidance as to how LWP can be used to send data? I'm
> confused.
>
> Thanks!
>
> RE: how to postback to a different URL than the one making the request?

You're right perhaps, I'm not thinking about my problem correctly. I'm
going to receive a request that is in XML format, like so:





















]>


sampletoken
sampleguid
sample.url.com


The postbackurl, sample.url.com is where I need to send the data and
I'm not sure how to do this. I thought lwp would come to the rescue
since I am so use to using it, but perhaps my thinking is in error and
LWP is not the right solution here?

Re: how to postback to a different URL than the one making the request?

am 01.06.2007 09:10:56 von mumia.w.18.spam+nospam

On 05/31/2007 07:49 PM, vidals wrote:
> [...]
> The postbackurl, sample.url.com is where I need to send the data and
> I'm not sure how to do this. I thought lwp would come to the rescue
> since I am so use to using it, but perhaps my thinking is in error and
> LWP is not the right solution here?
>
>
>

Hello vidals. I noticed the other threads you created on the same
subject. Please try to keep your posts on a certain subject within the
same thread you first created for that subject, and please only change
the subject line when the subject truly changes.

LWP::UserAgent has the feature that you're looking for; did you read the
documentation for that module?

Did you read Andy Lester's and Tim Allwine's messages?

use LWP::UserAgent;
my $url = 'http://sample.url.example.com/somescript';
my $lwp = LWP::UserAgent->new;
my $response = $lwp->post($url, { name1 => 'value1',
name2 = 'value2' });

However, before you can be sure what to name your POST variables, you'll
have to find out what the servers that will be receiving these requests
require.

These are questions for you to consider when writing your program:
What is the exact URL to the script that processes the POST request?
What are the form names that are required?
What kind of POST request is expected (application/x-www-form-urlencoded
or multipart/form-data)?

Re: how to postback to a different URL than the one making the request?

am 01.06.2007 09:56:07 von scratchcomputing

# from vidals
# on Thursday 31 May 2007 05:49 pm:

> I'm going to receive a request that is in XML format

That sounds like a "response". A "request" is what the client sends to
the server. You can request a GET, POST, PUT, DELETE, HEAD, etc.

>The postbackurl, sample.url.com is where I need to send the data and
>I'm not sure how to do this.

Do what? Send data or parse xml? LWP::UserAgent will indeed send data,
that's what request() does.

Unfortunately, how HTTP works doesn't seem to be common knowledge
because CGI has only ever used a very, very small subset of HTTP. As
soon as you start dealing with web services, you really have to go back
to the basics and understand the forgotten verbs.

http://www.w3.org/Protocols/rfc2616/rfc2616.html
http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch _style.htm

--Eric
--
Anyone who has the power to make you believe absurdities has the power
to make you commit injustices.
--Voltaire
---------------------------------------------------
http://scratchcomputing.com
---------------------------------------------------