Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to POST json data #51

Open
polibou opened this issue Nov 6, 2015 · 1 comment
Open

How to POST json data #51

polibou opened this issue Nov 6, 2015 · 1 comment

Comments

@polibou
Copy link

polibou commented Nov 6, 2015

Hi,

In this closed issue (#6) I see that it is possible to post JSON data. I can't seem to get it to work. I'm not a PHP expert so I could be missing something basic.

my code
$data = '{"action": "read"}';
$response = $client->fetch('https://the-api-resource', $data, 'POST');

I keep getting a "Authentication parameters missing" message from the server so I thought I might not have a proper access token but a var_dump of $client looks ok to me...

object(OAuth2\Client)#3 (10) { ["client_id":protected]=> string(8) "7c23519f" ["client_secret":protected]=> string(32) "6e71a3a1452f4ee1df71771192dbc526" ["client_auth":protected]=> int(0) ["access_token":protected]=> string(40) "c88eeaea6cf10ec207edfe0f0fc2e27d55f1cc29" ["access_token_type":protected]=> int(0) ["access_token_secret":protected]=> NULL ["access_token_algorithm":protected]=> NULL ["access_token_param_name":protected]=> string(12) "access_token" ["certificate_file":protected]=> NULL ["curl_options":protected]=> array(0) { } }

Thanks

@bcgoodmate
Copy link

See the sample solution here #54 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants