Jump to content

curl - unable to fake login


allasso

Recommended Posts

I sure hope this is an appropriate place for this question.  I haven't been able to find much else out there to post this on:

 

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?

 

 

Link to comment
https://forums.phpfreaks.com/topic/140798-curl-unable-to-fake-login/
Share on other sites

I am no guru with cURL by far, hell I have barely ever used it myself despite that I may one day.

 

Anyway I have done my share of research as well with it, and I can say one, its not as easy as the one liners your got above to do what you wish. two, even if the site isn't using cookies it is most likely if not definitely using sessions. Which is most likely why your getting the errors so to speak. If your script isn't authenticating, and then maintain it's authentication by keeping the connection alive so to speak then its not going to make it far enough into the blog you want to do anything worth your while.

 

One question though, seeing as its a blog, chances are it has an RSS feature, why go the route of RSS? but then again I havent the slightest idea on what it is exactly that your attempting to do. So that might not be an option.

 

I know this is going to be a cornball example, but if you want to learn more about curl, and logging into something and then doing something with it, google things like "php cURL myspace" tons of people attempting to make there own little web sites wanting to use some of there myspace to have similar issues, and you can probally find better answers quicker

Hello, Monkey tooth,

 

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 want you to know, though, that I sincerely appeciated your input.  The reason for not using RSS is that I am writing a script to run on a cron job.

 

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.

 

Allasso

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.