Hello! I am using LWP to post to a web page. The
post works fine, but the $response the comes back
contains the HTML of _another_ page that I have to
POST to.
This is where I get stuck.
Normally when I $agent->request( POST $url [...] ) I
know the $url. In this case I don't have a url -- I
have a $response with some html inside of it. How do
I POST to this new page? (I tried using HTML::Form as
well, using the HTML::Form->parse( $content, $uri )
mechanism, but this simply posted to the original page
I POST'ed to).
Source and headers given below.
Thanks in advance!
---------------------------src------------------
$url =
"http://fapt.efanniemae.com/eprosupp2/Content.jsp";
my $res = $ua->request( POST $url,
[ byPool => "false", poolOrCusip => "cusip",
bodyPage => "SearchCheck.jsp",
formAction => "search",
key1 => "31390JPE5",
key2 => "", key3 => "", key4 => "",
key5 => "", key6 => "", key7 => "", key8 => "",
key9 => "", key10 => "", key11 => "",
key12 => "", key13 => "", key14 => "",
key15 => "", key16 => "", key17 => "",
key18 => "", key19 => "", key20 => "",
RetrieveSupps => "Retrieve+Supplements" ] );
Carp::croak( "could not POST to $url , reason:" .
status_message( $res ) )
unless $res->is_success;
#this is where I get stuck.
#the form that comes back takes POST arguments
#formAction=retrieve&
#RetrieveSupps=Retrieve+Supplements
#how do I issue the post to this new page?
---------------------------src------------------
Here are the full headers as displayed by Mozilla's
'Live HTTP Header' ( neat tool, BTW ):
http://fapt.efanniemae.com/eprosupp2/styles/images/EMBBorderColor2.gif
GET /eprosupp2/styles/images/EMBBorderColor2.gif
HTTP/1.1
Host: fapt.efanniemae.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1;
en-US; rv:1.2.1) Gecko/20021130
Accept-Language: en-us, en;q=0.50
Accept-Encoding: gzip, deflate, compress;q=0.9
Accept-Charset: ISO-8859-1, utf-8;q=0.66, *;q=0.66
Keep-Alive: 300
Connection: keep-alive
Accept:
video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1
Referer:
http://fapt.efanniemae.com/eprosupp2/Content.jsp
Cookie:
JSESSIONID=2wznZyYIho2c4DL371D6KROwvA33EGDywErJ4sXdjOO5YHrDZF30!-313011347!pfapt-ap05!7101!7002
HTTP/1.x 404 Not found
Server: Netscape-Enterprise/4.1
Date: Thu, 13 Mar 2003 23:37:23 GMT
Content-Length: 1317
Content-Type: text/html
Connection: Close
----------------------------------------------------------
http://fapt.efanniemae.com/eprosupp2/styles/images/EMBBorderColor1.gif
GET /eprosupp2/styles/images/EMBBorderColor1.gif
HTTP/1.1
Host: fapt.efanniemae.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1;
en-US; rv:1.2.1) Gecko/20021130
Accept-Language: en-us, en;q=0.50
Accept-Encoding: gzip, deflate, compress;q=0.9
Accept-Charset: ISO-8859-1, utf-8;q=0.66, *;q=0.66
Keep-Alive: 300
Connection: keep-alive
Accept:
video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1
Referer:
http://fapt.efanniemae.com/eprosupp2/Content.jsp
Cookie:
JSESSIONID=2wznZyYIho2c4DL371D6KROwvA33EGDywErJ4sXdjOO5YHrDZF30!-313011347!pfapt-ap05!7101!7002
HTTP/1.x 404 Not found
Server: Netscape-Enterprise/4.1
Date: Thu, 13 Mar 2003 23:37:23 GMT
Content-Length: 1317
Content-Type: text/html
Connection: Close
----------------------------------------------------------
http://fapt.efanniemae.com/eprosupp2/Content.jsp
POST /eprosupp2/Content.jsp HTTP/1.1
Host: fapt.efanniemae.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1;
en-US; rv:1.2.1) Gecko/20021130
Accept:
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,text/css,*/*;q=0.1
Accept-Language: en-us, en;q=0.50
Accept-Encoding: gzip, deflate, compress;q=0.9
Accept-Charset: ISO-8859-1, utf-8;q=0.66, *;q=0.66
Keep-Alive: 300
Connection: keep-alive
Referer:
http://fapt.efanniemae.com/eprosupp2/Content.jsp
Cookie:
JSESSIONID=2wznZyYIho2c4DL371D6KROwvA33EGDywErJ4sXdjOO5YHrDZF30!-313011347!pfapt-ap05!7101!7002
Content-Type: application/x-www-form-urlencoded
Content-Length: 248
byPool=false&poolOrCusip=cusip&bodyPage=SearchCheck.jsp&formAction=search&key1=31390JPE5&key2=&key3=&key4=&key5=&key6=&key7=&key8=&key9=&key10=&key11=&key12=&key13=&key14=&key15=&key16=&key17=&key18=&key19=&key20=&RetrieveSupps=Retrieve+Supplements
HTTP/1.x 200 OK
Server: Netscape-Enterprise/4.1
Date: Thu, 13 Mar 2003 23:37:32 GMT
Content-Type: text/html
Connection: Close
----------------------------------------------------------
http://fapt.efanniemae.com/eprosupp2/styles/images/EMBBorderColor1.gif
GET /eprosupp2/styles/images/EMBBorderColor1.gif
HTTP/1.1
Host: fapt.efanniemae.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1;
en-US; rv:1.2.1) Gecko/20021130
Accept-Language: en-us, en;q=0.50
Accept-Encoding: gzip, deflate, compress;q=0.9
Accept-Charset: ISO-8859-1, utf-8;q=0.66, *;q=0.66
Keep-Alive: 300
Connection: keep-alive
Accept:
video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1
Referer:
http://fapt.efanniemae.com/eprosupp2/Content.jsp
Cookie:
JSESSIONID=2wznZyYIho2c4DL371D6KROwvA33EGDywErJ4sXdjOO5YHrDZF30!-313011347!pfapt-ap05!7101!7002
HTTP/1.x 404 Not found
Server: Netscape-Enterprise/4.1
Date: Thu, 13 Mar 2003 23:37:32 GMT
Content-Length: 1317
Content-Type: text/html
Connection: Close
----------------------------------------------------------
http://fapt.efanniemae.com/eprosupp2/styles/images/EMBBorderColor2.gif
GET /eprosupp2/styles/images/EMBBorderColor2.gif
HTTP/1.1
Host: fapt.efanniemae.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1;
en-US; rv:1.2.1) Gecko/20021130
Accept-Language: en-us, en;q=0.50
Accept-Encoding: gzip, deflate, compress;q=0.9
Accept-Charset: ISO-8859-1, utf-8;q=0.66, *;q=0.66
Keep-Alive: 300
Connection: keep-alive
Accept:
video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1
Referer:
http://fapt.efanniemae.com/eprosupp2/Content.jsp
Cookie:
JSESSIONID=2wznZyYIho2c4DL371D6KROwvA33EGDywErJ4sXdjOO5YHrDZF30!-313011347!pfapt-ap05!7101!7002
HTTP/1.x 404 Not found
Server: Netscape-Enterprise/4.1
Date: Thu, 13 Mar 2003 23:37:33 GMT
Content-Length: 1317
Content-Type: text/html
Connection: Close
----------------------------------------------------------
http://fapt.efanniemae.com/eprosupp2/styles/images/EMBBorderColor1.gif
GET /eprosupp2/styles/images/EMBBorderColor1.gif
HTTP/1.1
Host: fapt.efanniemae.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1;
en-US; rv:1.2.1) Gecko/20021130
Accept-Language: en-us, en;q=0.50
Accept-Encoding: gzip, deflate, compress;q=0.9
Accept-Charset: ISO-8859-1, utf-8;q=0.66, *;q=0.66
Keep-Alive: 300
Connection: keep-alive
Accept:
video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1
Referer:
http://fapt.efanniemae.com/eprosupp2/Content.jsp
Cookie:
JSESSIONID=2wznZyYIho2c4DL371D6KROwvA33EGDywErJ4sXdjOO5YHrDZF30!-313011347!pfapt-ap05!7101!7002
HTTP/1.x 404 Not found
Server: Netscape-Enterprise/4.1
Date: Thu, 13 Mar 2003 23:37:52 GMT
Content-Length: 1317
Content-Type: text/html
Connection: Close
----------------------------------------------------------
http://fapt.efanniemae.com/eprosupp2/styles/images/EMBBorderColor2.gif
GET /eprosupp2/styles/images/EMBBorderColor2.gif
HTTP/1.1
Host: fapt.efanniemae.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1;
en-US; rv:1.2.1) Gecko/20021130
Accept-Language: en-us, en;q=0.50
Accept-Encoding: gzip, deflate, compress;q=0.9
Accept-Charset: ISO-8859-1, utf-8;q=0.66, *;q=0.66
Keep-Alive: 300
Connection: keep-alive
Accept:
video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1
Referer:
http://fapt.efanniemae.com/eprosupp2/Content.jsp
Cookie:
JSESSIONID=2wznZyYIho2c4DL371D6KROwvA33EGDywErJ4sXdjOO5YHrDZF30!-313011347!pfapt-ap05!7101!7002
HTTP/1.x 404 Not found
Server: Netscape-Enterprise/4.1
Date: Thu, 13 Mar 2003 23:37:52 GMT
Content-Length: 1317
Content-Type: text/html
Connection: Close
----------------------------------------------------------
http://fapt.efanniemae.com/eprosupp2/process
POST /eprosupp2/process HTTP/1.1
Host: fapt.efanniemae.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1;
en-US; rv:1.2.1) Gecko/20021130
Accept:
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,text/css,*/*;q=0.1
Accept-Language: en-us, en;q=0.50
Accept-Encoding: gzip, deflate, compress;q=0.9
Accept-Charset: ISO-8859-1, utf-8;q=0.66, *;q=0.66
Keep-Alive: 300
Connection: keep-alive
Referer:
http://fapt.efanniemae.com/eprosupp2/Content.jsp
Cookie:
JSESSIONID=2wznZyYIho2c4DL371D6KROwvA33EGDywErJ4sXdjOO5YHrDZF30!-313011347!pfapt-ap05!7101!7002
Content-Type: application/x-www-form-urlencoded
Content-Length: 54
formAction=retrieve&RetrieveSupps=Retrieve+Supplements
HTTP/1.x 302 Moved Temporarily
Server: Netscape-Enterprise/4.1
Date: Thu, 13 Mar 2003 23:37:54 GMT
Location:
http://fapt.efanniemae.com/eprosupp2/RetrievePDF.jsp
Content-Type: application/pdf
Connection: Close
----------------------------------------------------------
http://fapt.efanniemae.com/eprosupp2/RetrievePDF.jsp
GET /eprosupp2/RetrievePDF.jsp HTTP/1.1
Host: fapt.efanniemae.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1;
en-US; rv:1.2.1) Gecko/20021130
Accept:
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,text/css,*/*;q=0.1
Accept-Language: en-us, en;q=0.50
Accept-Encoding: gzip, deflate, compress;q=0.9
Accept-Charset: ISO-8859-1, utf-8;q=0.66, *;q=0.66
Keep-Alive: 300
Connection: keep-alive
Referer:
http://fapt.efanniemae.com/eprosupp2/Content.jsp
Cookie:
JSESSIONID=2wznZyYIho2c4DL371D6KROwvA33EGDywErJ4sXdjOO5YHrDZF30!-313011347!pfapt-ap05!7101!7002
HTTP/1.x 200 OK
Server: Netscape-Enterprise/4.1
Date: Thu, 13 Mar 2003 23:37:54 GMT
Content-Length: 7877
Content-Type: application/pdf
Connection: Keep-Alive
----------------------------------------------------------
__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - establish your business online
http://webhosting.yahoo.com