in reply to Re: download file by using lwp::useragent POST method
in thread download file by using lwp::useragent POST method

If I surf the web site manually
(http://www.tcichemicals.com/eshop/en/ap/catalog/coa_result /?page=coa) and post with the two variables,
product_number=E0393,product_number=DY5BB
the browser will prompt file download dialog
but my perl script code
$response->decoded_content( charset => 'none' );
right now only returns the web site content, not the desired file.
Is it possible to ask lwp to return the file content, not the web site content?

Replies are listed 'Best First'.
Re^3: download file by using lwp::useragent POST method
by Corion (Patriarch) on Dec 13, 2017 at 08:06 UTC

    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.