Hi All,
I'm having trouble ripping some info from a dynamic web page using a
$ua->post request. For testings sake a made a copy of a response I got
from the target page and put it in localhost. Here's the code:
<start code>
$request = $ua->post('https://www.theirsite.com/form.asp', \%post_form);
# $request = $ua->post('https://localhost/copy/of/response.html',
\%post_form);
if ($request->is_success) {
if ($request->content =~ /Thank you! We have received your request for
insurance and payment/) {
if ($request->content =~ /<b>Transaction # (.*)<\/b>/) {
$transaction_id = $1;
# ...load $transaction_id to table and finish order
}
}
</finish code>
<snippet of response.html>
...
<td align="center">
<b><font face="Arial, Helvetica, sans-serif" size="3"
color="#FF3333">
Thank you! We have received your request for insurance and
payment.</font></b>
[... about 26 more lines down in the page ...]
<td COLSPAN=4 ALIGN=CENTER> <font face="Helvetica,
Arial" SIZE=3 COLOR="#000000"><b>Transaction # V64F44742236</b></font>
<font face="Verdana, Helvetica, Arial"
SIZE=2 COLOR="#000000"><b>Date: </b></font>1/14/2004</td>
...
</end of snippet>
Now as shown the script will find the Thank you! part but will not find
the transaction number, but when I switch it to the post to localhost it
find the transaction id and loads it into my table just fine. What is
going on here? Is it the difference between a dynamic page and a static
page being posted to? Am I not recieving all the chunks of response in
time to get the transaction id? Is my regex just plain lame? I'm a
semi-newbie and have played with this for several days but to no avail.
Any help would greatly be appreciated.
Thanks,
Justin