Don't ask to ask, just ask | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
You don't tell us where your approach fails and how. Simply converting your curl command line to LWP::UserAgent using curl2lwp gives:
If your question is how to extract the cookie from a browser request, have a look at the response you see in the browser. If your question is how to extract the cookie automatically without involving a browser, first you need to find out what request you have to make to which URL, and also whether sending the username and password as a JSON string in a POST request is the correct approach there. If that is correct, then instead of inspecting the responseContent, inspect the response headers using $response->headers->as_string(). You already mention a variable suggestively named $cookies, but you never pass it anywhere. See the ->cookie_jar method of LWP::UserAgent on how to set a cookie jar for LWP::UserAgent. In reply to Re: LWP get Cookies for API
by Corion
|
|