in reply to Re^2: refreshing a page/session without re-submitting search
in thread refreshing a page/session without re-submitting search

the page isn't really ever refreshing so you don't need to re-request the data using LWP::Useragent. Just search through the response content for the var numHits line like:
my $response = LWP::UserAgent->request($request); my $total_hits = 0; if($response->content =~ m/var numHits = '(\d+)'/){ $total_hits = $1; }
You can do something similar to get the numPages value but you shouldn't need to re-request the page.

Replies are listed 'Best First'.
Re^4: refreshing a page/session without re-submitting search
by seaver (Pilgrim) on Sep 22, 2004 at 18:10 UTC
    Yeah, but the thing is that it DOES refresh. If you look at the top of the HTML:
    <td width="20%" class="sum_number_results"> <span id="hitCount_top">...</span> results found </td>

    whats happening is that this page doesnt show the number of results found because the server is still searching, and it then refreshes the page to update that number, which is currently "..."

    when I run it in the web, it refreshes until it finishes with 600 results....does this make sense?

    Cheers
    Sam

      "refresh" is the wrong term. The page isn't reloaded, the javascript code simply re-writes that part of the HTML. In your case, you don't need to have the javascript update the ... part of the page since the data is already there at the bottom of the page like you found. If you want the hit count, don't look in
      <span id="hitCount_top">...</span> results found
      look at the numHits javascript at the bottom of the page.

      Are you trying to re-display the results exactly as they are when you look at it in a browser or are you parsing the file to get bits of information about the result set?
        OK I starting to understand this now, thank you

        What's happening is that the hitcount itself goes up as the server continues to search, so I can see now that the JavaScript simply waits a little while, and then writes in the hitcount.

        But from what you say, the final hitcount is already found and present in the bottom of the page am I right?

        What I'm trying to do here is to make sure I get ALL the results available, because I want to go on to another page, and click the email button, but I thought I wasn't getting ALL the results available first (whether or not they are on the same page).

        I'm expecting 600, as determined by my web search but only getting 67, and it occured to me this morning that the Http::Request::Form which automatically does the hidden buttons and defaulted values may be missing something which causes the search to be limited, so checking it out

        thanks for your help
        Sam