• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: do shell script, curl and cookies
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: do shell script, curl and cookies


  • Subject: Re: do shell script, curl and cookies
  • From: Jim Skibbie <email@hidden>
  • Date: Thu, 11 Apr 2013 21:02:10 +0000
  • Thread-topic: do shell script, curl and cookies

That looks right to me, but maybe you should flesh out a known path to your cookie, just to confirm it is writing something and it where and what you expect:


do shell script "curl --cookie-jar ~/Desktop/testcookie 'http://www.example.com/login?username=bob&password=pass'"

do shell script "curl --cookie ~/Desktop/testcookie 'http://www.example.com/search?q=something'"



You might want to also look at the HTTP request to make sure you aren't getting redirected as part of the request. You may need to put a –L flag in your second curl command so that it follows the redirect.

Jim


Date: Thu, 11 Apr 2013 16:14:57 +0200
From: Håvard Graudo

I have problems using cookies with curl via do shell script.

I want to login and get a cookie, then send commands back to the server, including the cookie.

This works in Terminal:
curl --cookie-jar zecookie.txt 'http://www.example.com/login?username=bob&password=pass'
--> login OK, sessionID: 1i7nm0ch6pphezdqkulhdub30 blah blah
curl --cookie zecookie.txt  'http://www.example.com/search?q=something'
--> returns my search. all nice and dandy

The information stored in the cookie is a plain Netscape HTTP Cookie File.

However if I do the SAME THING using 'do shell script' it fails:
do shell script "curl --cookie-jar zecookie.txt 'http://www.example.com/login?username=bob&password=pass'"
--> login OK, sessionID: s04988pspn6otuaaz6xeuooy blah blah
do shell script "curl --cookie zecookie.txt  'http://www.example.com/search?q=ssomething'"
-- NOT LOGGED IN

What works in Terminal does not with 'do shell script'.

Can someone help me in the right direction here?

Thank you

Håvard
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: do shell script, curl and cookies
      • From: Christopher Nebel <email@hidden>
    • Re: do shell script, curl and cookies
      • From: Håvard Graudo <email@hidden>
    • Re: do shell script, curl and cookies
      • From: Doug McNutt <email@hidden>
  • Prev by Date: Re: Applescript-ObjC: Actions and Outlets Tutorial?
  • Next by Date: Re: do shell script, curl and cookies
  • Previous by thread: Re: do shell script, curl and cookies
  • Next by thread: Re: do shell script, curl and cookies
  • Index(es):
    • Date
    • Thread