in reply to Re: Mechanize and javascript (yes, another)
in thread Mechanize and javascript (yes, another)

Yes this worked. When it prints URI it gives the original url, but when I print the code to a file, I can verify that it has indeed gone to the correct page. Any idea why that is?

More importantly, now when I have perl search through the response, it won't find this phrase

"DHL Ground Service</a> <br> (Letter &#150; 150 Pounds)</div></td> + <td><div class="pL5">Monday,&nbsp;Jan&nbsp;9,&nbsp;2006 &n +bsp;By end of day<img src="http://www.dhl-usa.com/images/blank.gif" w +idth="1" height="1"></div></td> <td><div class="pL5">1"
but it will find "help you create, print, and pay your shipping" which is only found on the same page.

I need to extract the last "1" from the string. Any ideas how? Do I have to do a search for "DHL Ground Service" and then somehow search only what is in the response after that for the string connected to the number one that I'm looking for? Sorry this post is funny, I don't know how to disable the HTML tags on my post. Thanks again to anybody who can help!

Replies are listed 'Best First'.
Re^3: Mechanize and javascript (yes, another)
by marto (Cardinal) on Jan 07, 2006 at 00:24 UTC
    Hi bcdeery,

    Looks like you forgot to login before posting your reply.

    "Yes this worked. When it prints URI it gives the original url, but when I print the code to a file, I can verify that it has indeed gone to the correct page. Any idea why that is?"

    It is because the content of the page is dynamically generated. The URL is the same, but the content of the page is different because you submitted the form with the values needed to process your input (inserting values into the form fields and setting "hdnAction" = "Calculate"). As for dealing with the output, I prefer to use HTML::TokeParser or HTML::TokeParser::Simple to parse out the data I want from the HTML tags. I prefer this method to using a regex as you can't always depend on good quality data, and these modules are tried and tested :) Read the module documentation get the drift of how to use them, I wont post an example as there are good examples to work with in the docs.

    Hope this helps.

    Martin