[UPHPU] curl script to log into site
Wade Preston Shearer
wadeshearer.lists at me.com
Fri Apr 6 22:03:42 MDT 2012
I am trying to write a cURL script that authenticates with a site and then downloads a file. The issue is that posting to the form action directly does not work. The reason for that is because the website generates a token when you access the log in form and passes it in via the URL.
So, I think to complete this, I would have to do two cURL hits:
1. One to hit the original URL. Handle the redirect. Get the token out the of the URL.
2. Hit the second URL passing the token in as a GET parameter as I POST in the log-in form vars.
I know how to do #2 but am not sure about #1 or how to complete #1 and #1 in sequence in the same script.
Any pointers anyone can provide?
More information about the UPHPU