I need to query a rest api and pass in oauth credentials. I am very new to php and would love some assistance on how to do this!

Thanks to all in advance!

Hi @jo15765

In order to query a REST API you will need some way of issuing HTTP requests.

The easiest way is to use file_get_contents.

In your particular case, since you need to use OAuth that’s probably not going to be enough.

You can try using cURL which is more low level but will do the job.

Now, you’re probably going to need to issue at least two requests, the first to OAuth provider to get the token and then the second to your API and send the token as a header.

It all depends on the specifics of the API you’re using, do you have some documentation?

Sponsor our Newsletter | Privacy Policy | Terms of Service