thevoipman
thevoipman

Reputation: 1823

PHP Curl with Variables

I am trying to pass a few variables to the shell_exec command, but for some reason it's not picking up the data in the php variables. Please help me, and the below is what I got:

$out = exec('curl -silent https://api.stripe.com/v1/charges -u sk_live_sdfsdfdsfsdfdf: -d "amount=$aaamount" -d currency=usd -d "description=BBB $aaamount" -d "card[number]=$ccnumber" -d "card[exp_month]=$expm" -d "card[exp_year]=$expy" -d "card[cvc]=611"');

Any kind of help I can get on this is greatly appreciated.

Upvotes: 1

Views: 455

Answers (1)

Jonathon Reinhart
Jonathon Reinhart

Reputation: 137398

You're aware that PHP has bindings to cURL, right?

Besides, on the very front page of Stripe, right where you probably copied that curl command line, is a drop-down to change to other languages, namely PHP. They have an API for you to use:

require_once('./lib/Stripe.php');
Stripe::setApiKey("sk_test_mkGsLqEW6SLnZa487HYfJVLf");

Stripe_Charge::create(array(
  "amount" => 400,
  "currency" => "usd",
  "card" => array(
    "number" => "4242424242424242",
    "exp_month" => 6,
    "exp_year" => 2014,
    "cvc" => 314
  ),
  "description" => "Charge for [email protected]")
);

Upvotes: 2

Related Questions