\tmhOAuth
tmhOAuth
An OAuth 1.0A library written in PHP.
The library supports file uploading using multipart/form as well as general
REST requests. OAuth authentication is sent using the an Authorization Header.
- Author: themattharris
Synopsis
class tmhOAuth
{
- // constants
- const VERSION = '0.7.5';
- // members
- public array $response = ;
- // methods
- public void __construct()
- private void set_user_agent()
- private void create_nonce()
- private void create_timestamp()
- private $data safe_encode()
- private string safe_decode()
- private array get_defaults()
- public array extract_params()
- private void prepare_method()
- private void prepare_url()
- private void prepare_params()
- private void prepare_signing_key()
- private void prepare_base_string()
- private void prepare_auth_header()
- private void sign()
- public int request()
- public void streaming_request()
- private array update_metrics()
- public string url()
- public string transformText()
- private string curlHeader()
- private int curlWrite()
- private int curlit()
Constants
Name | Value |
---|---|
VERSION | '0.7.5' |
Members
public
- $response
Methods
private
- create_nonce() — Generates a random OAuth nonce.
- create_timestamp() — Generates a timestamp.
- curlHeader() — Utility function to parse the returned curl headers and store them in the class array variable.
- curlWrite() — Utility function to parse the returned curl buffer and store them until an EOL is found. The buffer for curl is an undefined size so we need to collect the content until an EOL is found.
- curlit() — Makes a curl request. Takes no parameters as all should have been prepared by the request method
- get_defaults() — Returns an array of the standard OAuth parameters.
- prepare_auth_header() — Prepares the Authorization header
- prepare_base_string() — Prepare the base string.
- prepare_method() — Prepares the HTTP method for use in the base string by converting it to uppercase.
- prepare_params() — Prepares all parameters for the base string and request.
- prepare_signing_key() — Prepares the OAuth signing key
- prepare_url() — Prepares the URL for use in the base string by ripping it apart and reconstructing it.
- safe_decode() — Decodes the string or array from it's URL encoded form If an array is passed each array value will will be decoded.
- safe_encode() — Encodes the string or array passed in a way compatible with OAuth.
- set_user_agent() — Sets the useragent for PHP to use If '$this->config['user_agent']' already has a value it is used instead of one being generated.
- sign() — Signs the request and adds the OAuth signature. This runs all the request parameter preparation methods.
- update_metrics() — Handles the updating of the current Streaming API metrics.
public
- __construct() — Creates a new tmhOAuth object
- extract_params() — Extracts and decodes OAuth parameters from the passed string
- request() — Make an HTTP request using this library. This method doesn't return anything.
- streaming_request() — Make a long poll HTTP request using this library. This method is different to the other request methods as it isn't supposed to disconnect
- transformText() — Public access to the private safe decode/encode methods
- url() — Utility function to create the request URL in the requested format