OAuth::getRequestHeader

(No version information available, might only be in Git)

OAuth::getRequestHeaderOAuth ヘッダ文字列シグネチャを生成する

説明

public OAuth::getRequestHeader(string $http_method, string $url, mixed $extra_parameters = ?): string|false

最後の HTTP メソッド、URL そしてパラメータ文字列あるいは配列にもとづいて OAuth ヘッダ文字列シグネチャを生成します。

パラメータ

http_method

リクエストの HTTP メソッド。

url

リクエストの URL。

extra_parameters

パラメータ文字列あるいは配列。

戻り値

生成されたリクエストヘッダを文字列で返します。失敗した場合に false を返します

add a note add a note

User Contributed Notes 1 note

up
8
me at chrishowie dot com
8 years ago
The documentation does not specify the difference between passing a string and passing an array for the third parameter.  We spent two days debugging before reading the C source code to figure out that there is a significant and undocumented difference between the two.

"a=1" and array("a" => 1) are handled very differently!

If you are making a POST/PUT request (or anything with an entity body) then you should pass that as a string.

If you are making a request with a query string, you should pass that as an associative array.

If you pass "a=1" intending that to specify the query string, the generated signature will be invalid -- it will process this as if you were POSTing the content "a=1" instead.
To Top