Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: download file by using lwp::useragent POST method

by TYRuan (Initiate)
on Dec 13, 2017 at 07:40 UTC ( [id://1205394]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1205394]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2024-03-28 08:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found