There are several APIs I'm trying to access to grab data in PHP. They all use OAuth authorization and I can't for the life of me figure it out.
If I make a CURL request or file_get_contents request for data using the API's URL, obviously it asks me for authorization.
My question is, how do I initialize this authorization using OAuth?
I have my consumer key, consumer secret, OAuth token, and OAuth token secret. One of the APIs stated that I need to include a proper OAuth header with my request, i.e.:
Authorization: OAuth
oauth_consumer_key="key",
oauth_token="token",
oauth_signature_method="HMAC-SHA1",
oauth_signature="f922O9A2W5mFwDgiDvZbTSMK%2FPY%3D",
oauth_timestamp="157131220",
oauth_nonce="90922def48616d6d65724c61686176",
oauth_version="1.0"
But I have no idea how to actually code this header in PHP properly.
I've tried with header() at the top of my PHP script or using a context parameter in my file_get_contents request. I've looked into curl headers as well.
I just can't figure it out.
I feel like I'm missing something obvious, any advice would be much appreciated!