Reputation: 2535
I have an API for an mobile app. One of the API function is to sign in the user. When user is signed in he can access other API functions. I do this by tracking user session. But here is my problem I am testing API with curl and I can get it to work. I tried accessing API with browser and it worked but when I try with command line curl it doesnt, so I think curl doesnt send cookie. How can I do that?
Upvotes: 0
Views: 693
Reputation: 4078
You need to say curl where to save and load cookies: http://curl.haxx.se/docs/httpscripting.html (Chapter 10)
For you it must be curl --cookie cookies.txt --cookie-jar newcookies.txt http://www.example.com
where --cookie
tells curl where to load cookies and --cookie-jar
where to save cookies. Those files can be the same.
Upvotes: 2