Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

sbkl's avatar
Level 17

Translate http post request from curl to php with guzzle

Hello,

I succeed to translate this curl request:

curl https://connect.stripe.com/oauth/token \
   -d client_secret=myClientSecret
   -d code=AUTHORIZATION_CODE \
   -d grant_type=authorization_code

to php using guzzlehttp like this:

    $client = new \GuzzleHttp\Client();

    $response = $client->post('https://connect.stripe.com/oauth/token', [
        'form_params' => [
            'client_secret' => myClientSecret,
            'code' => AUTHORIZATION_CODE,
            'grant_type' => "authorization_code"
        ]]);

Now, I would like to know how to do the same with the following post request:

curl https://connect.stripe.com/oauth/deauthorize \
   -u {YOUR_SECRET_KEY}: \
   -d client_id=ca_8e8Y5aZOmUEaM47nBRYvL6NirsnkEKPD \
   -d stripe_user_id=acct_Ng24IGpK2whxwj

I know how to handle the lines with -d just like the first request. However, what is the syntax to use to integrate the secret key parameter with -u?

Thank you.

0 likes
2 replies

Please or to participate in this conversation.