Hello,
I have searched for a good part of the day yesterday, but cannot seem to find an answer to this. I hope this is an appropriate forum for my question.
I am wanting to download a blog web page using a script. It requires username and password login. I have tried the following (an example) to no avail:
curl -d username=username -d password=password http://siteurl/index.php
I then tried this hoping that I could get the session started and then go to the page:
curl -d username=username -d password=password --url http://siteurl/index.php --url http://siteurl/desired_page.php
and the same as above using -u usernameassword instead of -d
I get the pages but I am not logged in. I have tried these methods on other pages using post forms for passwords and it works fine. I have checked to the source of the login pages and I am using the correct name values for password and username. I am trying to download pages that are privy only to members, and I cannot download them
I don't believe the site is using cookies to remember my login info for a session because when I log in and out using firefox, my cookie list does not change.
I noticed that I can create a dummy html login page with just a form where I submit the same information, and can log into the index page just fine.
I cannot understand then why what I have tried using curl does not work, since it works on other sites I have tried it on.
I double checked the names and values and they are correct.
Does anyone have any ideas what is happening with this?
curl - unable to fake login
Moderator: General Moderators
- sergio-pro
- Forum Commoner
- Posts: 88
- Joined: Sat Dec 27, 2008 12:26 pm
Re: curl - unable to fake login
thank you, sergio, a lot of good stuff there. Haven't gotten his script to work yet, but still working on it.
Using the liveHTTPheaders thing, though, I was able to get the correct data to put in the command line script that I posted above, and got logged in. I just haven't been able to get past that point and get to the page I want.
In Chad's script, I don't even get logged in...
I'll keep tinkering.
Thanks again
Using the liveHTTPheaders thing, though, I was able to get the correct data to put in the command line script that I posted above, and got logged in. I just haven't been able to get past that point and get to the page I want.
In Chad's script, I don't even get logged in...
I'll keep tinkering.
Thanks again
Re: curl - unable to fake login
Hello again Sergio,
I am very happy to report that this one WAS as easy as the one liners I had. Just needed some cookie stuff, and more data. I ended up with something like:
curl -b cookiejar -c cookiejar -d "login data and then some..." url/index.php
curl -b cookiejar -c cookiejar url/page_i_really_wanted.php
I found the data I needed by using liveHTTPheaders and capturing the data off of a login from firefox.
I was grateful to find this little help on an old mailing list, as it seems everything I googled for was using PHP and had about 30 lines of code. I really wanted to keep it simple, and I really wanted to stick with a shell script.
Thanks again for the valuable tip.
Allasso
I am very happy to report that this one WAS as easy as the one liners I had. Just needed some cookie stuff, and more data. I ended up with something like:
curl -b cookiejar -c cookiejar -d "login data and then some..." url/index.php
curl -b cookiejar -c cookiejar url/page_i_really_wanted.php
I found the data I needed by using liveHTTPheaders and capturing the data off of a login from firefox.
I was grateful to find this little help on an old mailing list, as it seems everything I googled for was using PHP and had about 30 lines of code. I really wanted to keep it simple, and I really wanted to stick with a shell script.
Thanks again for the valuable tip.
Allasso