dont understand Curl
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 349
- Joined: Tue Oct 28, 2008 1:23 am
- Contact:
dont understand Curl
Hey there. I'm trying to authenticate a Stripe transaction with LC script, and Yp totally don't understand Curl. According to the Stripe api guide, this is what I need to post to the stripe api URL:
curl https://api.stripe.com/v1/charges \
-u sk_test_123456ABCDEFG: \
-d amount=999 \
-d currency=usd \
-d description="Example charge" \
-d source=tok_visa
Tried POST ing that data a million ways to the URL, and I get nothing back. Can someone help?
Cheers,
Greg
curl https://api.stripe.com/v1/charges \
-u sk_test_123456ABCDEFG: \
-d amount=999 \
-d currency=usd \
-d description="Example charge" \
-d source=tok_visa
Tried POST ing that data a million ways to the URL, and I get nothing back. Can someone help?
Cheers,
Greg
-
- VIP Livecode Opensource Backer
- Posts: 7238
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: dont understand Curl
Curl is a shell command, did you try that?
For POST you'd need something like this:
But I'm not quite sure where the "?" should go, it depends on what the server expects. It might need to be at the beginning instead of after the "sk_test" entry.
For POST you'd need something like this:
Code: Select all
put "sk_test_123456ABCDEFG?amount=999¤cy=usd&description=Example charge&source=tok_visa" into tCmd
post tCmd to "https://api.stripe.com/v1/charges"
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- Posts: 349
- Joined: Tue Oct 28, 2008 1:23 am
- Contact:
Re: dont understand Curl
Thank you. I tried something like your POST command, but didn't have a "?" in there. I'll give that a shot. But reading around - doesn't a Curl command require some kind of header?
-
- Posts: 349
- Joined: Tue Oct 28, 2008 1:23 am
- Contact:
Re: dont understand Curl
tried that post and it doesn't work. How would I send this as a shell command?
-
- VIP Livecode Opensource Backer
- Posts: 7238
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: dont understand Curl
I'm not sure how the flags will impact it, but basically you can put the whole string into a variable and then:
get shell(tVar)
See the shell function in the dictionary. There's several examples there.
get shell(tVar)
See the shell function in the dictionary. There's several examples there.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- Posts: 349
- Joined: Tue Oct 28, 2008 1:23 am
- Contact:
Re: dont understand Curl
field "stripeCurl" =
$ curl https://api.stripe.com/v1/charges \
-u sk_test_abc123: \
-d amount=999 \
-d currency=usd \
-d description="Example charge" \
-d source=tok_visa
My code:
get shell(field "stripeCurl")
put it
I get error:
/bin/sh: line 1: command not found
$ curl https://api.stripe.com/v1/charges \
-u sk_test_abc123: \
-d amount=999 \
-d currency=usd \
-d description="Example charge" \
-d source=tok_visa
My code:
get shell(field "stripeCurl")
put it
I get error:
/bin/sh: line 1: command not found
Re: dont understand Curl
Leave out the $!
Should do the trick.
Code: Select all
curl https://api.stripe.com/v1/charges ...
-
- Posts: 349
- Joined: Tue Oct 28, 2008 1:23 am
- Contact:
Re: dont understand Curl
oh my god Klaus! Thats it. I was so shocked to see my it that didn't just say error, that it actually scared me a bit! Thanks!
Next question: I need to run this from lc server on Linux. My standard shell command should work right?
Next question: I need to run this from lc server on Linux. My standard shell command should work right?