【问题标题】:How can I apply this curl code in guzzle?如何在 guzzle 中应用此 curl 代码?
【发布时间】:2019-11-14 18:29:30
【问题描述】:

如何在 guzzle 中应用这种卷曲?谁能帮帮我?

curl -X POST -H "Content-Type: application/x-www-form-urlencoded" -d 'grant_type=client_credentials' --user TU_CLIENT_ID:TU_SECRET_ID https://xubio.com/API/1.1/TokenEndpoint

【问题讨论】:

  • 嗨弗朗西斯科!欢迎来到 SO!你有没有用a stroll through this guide 来问一个好问题?如果您可以更新您的问题以显示您尝试过的内容,其他人会更容易帮助您!

标签: php laravel curl guzzle


【解决方案1】:

解决办法

$client = new GuzzleHttp\Client();
$res = $client->request('POST', 'https://xubio.com/API/1.1/TokenEndpoint', [
    'auth' => [env('TU_CLIENT_ID'), env('TU_SECRET_ID')],
'form_params' => [
        'grant_type' => 'client_credentials']
    ]
]);

return $res->getBody();

希望对你有帮助

【讨论】:

    猜你喜欢
    • 2016-02-13
    • 1970-01-01
    • 2013-10-30
    • 2023-02-12
    • 2015-04-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多