Hello, I am having a horrible problem... I have a script that pulls down data from a web site containing product defect data every 10 min. The script is using LWP::UserAgent and HTTP::Request. The URL I am passing is targeting a report from the web app, basically passing in a new date range on in the URL each time. Here is the issue... I'm getting HORRIBLE cache problems. The http response is returning reports that are old or have nothing to do with the request I just sent. But, I can take that exact URL and put it into my IE browser on my windows machine and the web app returns the correct data every time. So it's something to do with my script or how I am sending the http header that it thinks it's ok to grab an old record. So, what are the commands/steps I need to take to ensure that the client request says to not take a cache copy of anything? Anyone know... or any hints? I've tried messing with the proxy settings, using a proxy or not I get the same result. Thanks in advance, jthornton
sub get_response { my $url = $_[0]; my $ua = LWP::UserAgent->new(agent => 'Mozilla/4.0 (compatible; MS +IE 6.0; Win32)'); $ua->cookie_jar(HTTP::Cookies->new); my $request = HTTP::Request->new( GET => $url ); my $response=$ua->request($request); while ($response->code eq "301" or $response->code eq "302") { $url=$response->header('Location'); $request=new HTTP::Request("GET", $url); $response=$ua->request($request); } my $response_string = $response->as_string; return $response_string; }

In reply to HTTP::Request and caching... by jthornton

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.