3

这是来自 Stripe API curl 方法的 curl 请求:

curl https://api.stripe.com/v1/accounts \
   -u sk_test_**********: \
   -d managed=false \
   -d country=US \
   -d email="bob@example.com"

现在我有这个唯一的代码:

<?php Unirest\Request::auth(Config::get("stripe.secret.api_key"), '');

        $headers = array(
            "Content-Type" => "application/json"
        );
        $body    = array(  
           "managed" => $_managed,
           "country" => $_country,
           "email"   => $_email,
        );
        $response = Unirest\Request::post("https://api.stripe.com/v1/accounts", $headers, $body);
        return array(
            'status'  => 'success',
            'message' => $response
        ); ?>

条纹返回方法是错误的。我认为它是-ucurl 的参数。

4

1 回答 1

0

我没有太多想法Unirest。由于您面临-u标头问题,您可以在 url 中使用授权参数,如下所示。

https://sk_test_RxRTXF1CDHuRw3ZUdynxnG6P:@api.stripe.com/v1/accounts
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
于 2016-02-10T10:32:27.403 回答