The "site content" and the "file content" are the same.

What you seem to get back is maybe something else and not the file download. Maybe you are not sending the same data as your browser does. Maybe there are cookies or other additional parameters that are hidden that need to be sent.

Consider using the "Developer Tools" of your browser of choice or a network sniffer to inspect what actually gets sent over the wire. Replicate that in your Perl script.

Maybe the returned page contains redirecting Javascript that sends your browser to the real file download URL.

There are many things that might be true in your situation but you are the only person to look at those.


In reply to Re^3: download file by using lwp::useragent POST method by Corion
in thread download file by using lwp::useragent POST method by TYRuan

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.