Plaid API php cURL不发送post数据
我正在尝试将下面的cURL转换为php cURL: $curl-X邮政编码\ -d客户id=“$plaid\u客户id”\ -d secret=“$plaid\u secret”\ -d public_token=“$public_token_来自网格链接模块” 使用此代码:Plaid API php cURL不发送post数据,php,api,curl,plaid,Php,Api,Curl,Plaid,我正在尝试将下面的cURL转换为php cURL: $curl-X邮政编码\ -d客户id=“$plaid\u客户id”\ -d secret=“$plaid\u secret”\ -d public_token=“$public_token_来自网格链接模块” 使用此代码: $data = array( "cliend_id"=>"test_id", "secret"=>"test_secret", "public_token
$data = array(
"cliend_id"=>"test_id",
"secret"=>"test_secret",
"public_token"=>"test,fidelity,connected");
$string = http_build_query($data);
echo $string;
//initialize session
$ch=curl_init("https://tartan.plaid.com/exchange_token");
//set options
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
//execute session
$exchangeToken = curl_exec($ch);
echo $exchangeToken;
//close session
curl_close($ch);
我得到的回应是:
cliend_id=test_id&secret=test_secret&public_token=test%2Cfidelity%2Cconnected{“code”:1100,“message”:“客户端id丢失”,“resolve”:“包括您的客户端id,以便我们知道您是谁。”}
我不确定我的格式有什么问题,使plaid无法识别文章的客户id部分。为了进一步的参考,我在下面有更多的细节
以下内容摘自可通过搜索“plaid api快速入门”找到的plaid站点:
参考文献 /交换令牌终结点 /exchange_令牌端点在tartan和生产环境中都可用。 方法端点必需参数可选参数 POST/exchange令牌客户端\u id、机密、公共\u令牌帐户\u id /exchange_令牌端点已经集成到plaid节点、plaid go、plaid ruby和plaid python客户端库中。对plaid java的支持即将到来 如果您使用的库尚不支持/exchange_令牌端点,则只需发出标准HTTP请求: $curl-X邮政编码\ -d客户id=“$plaid\u客户id”\ -d secret=“$plaid\u secret”\ -d public_token=“$public_token_来自网格链接模块” 对于有效请求,API将返回类似以下内容的JSON响应: { “访问令牌”:“foobar\u plaid\u访问令牌” }
问题是您正在发送
cliend\u id
,但服务器需要客户端id
:
$data = array(
"client_id"=>"test_id", // Use client_id instead of cliend_id
"secret"=>"test_secret",
"public_token"=>"test,fidelity,connected");
问题是您正在发送
cliend\u id
,但服务器需要client\u id
:
$data = array(
"client_id"=>"test_id", // Use client_id instead of cliend_id
"secret"=>"test_secret",
"public_token"=>"test,fidelity,connected");
因为那封信,我生命中的许多小时都过去了。谢谢你,很抱歉浪费你的时间…因为那封信,我生命中的许多小时都过去了。谢谢你,很抱歉浪费你的时间。。。