PHP Класс SnapchatAgent

Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$CURL_OPTIONS Default cURL options. It doesn't appear that the UA matters, but authenticity, right?

Открытые методы

Метод Описание
decryptCBC ( data $data, string $key, string $iv ) : data Decrypts blob data for stories.
decryptECB ( data $data ) : data Decrypts blob data for standard images and videos.
encryptECB ( data $data ) : data Encrypts blob data for standard images and videos.
get ( string $endpoint ) : data Performs a GET request. Currently only used for story blobs.
hash ( string $first, string $second ) : string Implementation of Snapchat's hashing algorithm.
isCompressed ( data $data ) : boolean Checks to see if a blob looks like a compressed file.
isMedia ( data $data ) : boolean Checks to see if a blob looks like a media file.
pad ( data $data, integer $blocksize = 16 ) : data Pads data using PKCS5.
post ( string $endpoint, array $data, array $params, boolean $multipart = FALSE ) : mixed Performs a POST request. Used for pretty much everything.
timestamp ( ) : integer Returns the current timestamp.
unCompress ( data $data ) : array Uncompress the blob and put the data into an Array.

Описание методов

decryptCBC() публичный метод

Decrypts blob data for stories.
public decryptCBC ( data $data, string $key, string $iv ) : data
$data data The data to decrypt.
$key string The base64-encoded key.
$iv string $iv The base64-encoded IV.
Результат data The decrypted data.

decryptECB() публичный метод

Decrypts blob data for standard images and videos.
public decryptECB ( data $data ) : data
$data data The data to decrypt.
Результат data The decrypted data.

encryptECB() публичный метод

Encrypts blob data for standard images and videos.
public encryptECB ( data $data ) : data
$data data The data to encrypt.
Результат data The encrypted data.

get() публичный метод

Performs a GET request. Currently only used for story blobs.
public get ( string $endpoint ) : data
$endpoint string The address of the resource being requested (e.g. '/story_blob' or '/story_thumbnail').
Результат data The retrieved data.

hash() публичный метод

Implementation of Snapchat's hashing algorithm.
public hash ( string $first, string $second ) : string
$first string The first value to use in the hash.
$second string The second value to use in the hash.
Результат string The generated hash.

isCompressed() публичный метод

Checks to see if a blob looks like a compressed file.
public isCompressed ( data $data ) : boolean
$data data The blob data (or just the header).
Результат boolean TRUE if the blob looks like a compressed file, FALSE otherwise.

isMedia() публичный метод

Checks to see if a blob looks like a media file.
public isMedia ( data $data ) : boolean
$data data The blob data (or just the header).
Результат boolean TRUE if the blob looks like a media file, FALSE otherwise.

pad() публичный метод

Pads data using PKCS5.
public pad ( data $data, integer $blocksize = 16 ) : data
$data data The data to be padded.
$blocksize integer The block size to pad to. Defaults to 16.
Результат data The padded data.

post() публичный метод

Performs a POST request. Used for pretty much everything.
public post ( string $endpoint, array $data, array $params, boolean $multipart = FALSE ) : mixed
$endpoint string The address of the resource being requested (e.g. '/update_snaps' or '/friend').
$data array An dictionary of values to send to the API. A request token is added automatically.
$params array An array containing the parameters used to generate the request token.
$multipart boolean If TRUE, sends the request as multipart/form-data. Defaults to FALSE.
Результат mixed The data returned from the API (decoded if JSON). Returns FALSE if the request failed.

timestamp() публичный метод

Returns the current timestamp.
public timestamp ( ) : integer
Результат integer The current timestamp, expressed in milliseconds since epoch.

unCompress() публичный метод

Array( overlay~zip-CE6F660A-4A9F-4BD6-8183-245C9C75B8A0 => overlay_file_data, media~zip-CE6F660A-4A9F-4BD6-8183-245C9C75B8A0 => m4v_file_data )
public unCompress ( data $data ) : array
$data data The blob data (or just the header).
Результат array Array containing both file contents, or FALSE if couldn't extract.

Описание свойств

$CURL_OPTIONS публичное статическое свойство

Default cURL options. It doesn't appear that the UA matters, but authenticity, right?
public static $CURL_OPTIONS