How do I use OAuth with PHP and cURL? How do I use OAuth with PHP and cURL? curl curl

How do I use OAuth with PHP and cURL?


i didn't used the youtube api before but i have made my own REST api using OAuth for a web app.

the header should be: application/x-www-form-urlencodedand as the example say, the parameters as oauth_consumer_key, oauth_signature_method,oauth_signature etc.. need to be sent using post, so you need to put it like this:

        $header[]         = 'Content-Type: application/x-www-form-urlencoded';            curl_setopt($ch, CURLOPT_HTTPHEADER,     $header);            curl_setopt($ch, CURLOPT_POST,        true);            curl_setopt($ch, CURLOPT_POSTFIELDS, urlencode("oauth_consumer_key=example.com&           oauth_signature_method=RSA-SHA1&           oauth_signature=wOJIO9A2W5mFwDgiDvZbTSMK%2FPY%3D&           oauth_timestamp=137131200&           oauth_nonce=4572616e48616d6d65724c61686176&           oauth_version=1.0"));

i hope it helps :D

Regards.