I’ve read through the documentation for using the APIs and I’m not quite sure how to incorporate OAuth into my current API calls. Right now, I just use…
file_put_contents("my_url");
… to get the JSON. Is there a way to add the OAuth credentials to that call or will I have to switch to using curl or some other method?
The answer to my question was to use stream_context_create as an additional argument to file_get_contents since the OAuth parameters get passed in the request headers.
The above is not an exact example as its context dependent. But the
stream_context_create()function is how you’d dictate what headers are sent when usingfile_get_contents().