PHP Класс seregazhuk\PinterestBot\Api\CurlHttpClient

Наследование: implements seregazhuk\PinterestBot\Api\Contracts\HttpClient
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
$cookieJar string Path to cookies file
$cookies seregazhuk\PinterestBot\Helpers\Cookies Cookies container
$cookiesPath string Path to directory to store cookie file
$curl resource Contains the curl instance.
$currentUrl string
$headers array
$options array Custom CURL options for requests.

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

Метод Описание
__construct ( Cookies $cookies )
cookie ( $name ) : mixed Get a cookie value by name
cookies ( ) : array Get all cookies
execute ( string $url, string $postString = '', array $headers = [] ) : string Executes curl request.
getCookiesPath ( ) : string
getCurrentUrl ( ) : string
loadCookies ( string $username = '' ) : seregazhuk\PinterestBot\Api\Contracts\HttpClient Load cookies for specified username
removeCookies ( )
setCookiesPath ( string $path ) Set directory to store all cookie files.
setOptions ( array $options ) : seregazhuk\PinterestBot\Api\Contracts\HttpClient Set custom Curl options to override default
useProxy ( string $host, string $port, string $auth = null, string $type = null ) : seregazhuk\PinterestBot\Api\Contracts\HttpClient
useSocksProxy ( string $host, string $port, null $auth = null ) : seregazhuk\PinterestBot\Api\Contracts\HttpClient

Защищенные методы

Метод Описание
callCurl ( ) : mixed
fillCookies ( )
getDefaultHttpOptions ( ) : array
init ( string $url, string $postString, array $headers ) Initializes curl resource with options.
initCookieFile ( string $username ) : string Returns cookie file name by username. If username is empty we use a random cookie name, to be sure we have different cookies in parallel sessions.
initCookieJar ( $username = '' ) Init cookie file for a specified username. If username is empty we use common cookie file for all sessions. If file does not exist it will be created in system temp directory.
makeHttpOptions ( string $postString = '' ) : array Adds necessary curl options for query.

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

__construct() публичный Метод

public __construct ( Cookies $cookies )
$cookies seregazhuk\PinterestBot\Helpers\Cookies

callCurl() защищенный Метод

protected callCurl ( ) : mixed
Результат mixed

cookies() публичный Метод

Get all cookies
public cookies ( ) : array
Результат array

execute() публичный Метод

Executes curl request.
public execute ( string $url, string $postString = '', array $headers = [] ) : string
$url string
$postString string
$headers array
Результат string

fillCookies() защищенный Метод

protected fillCookies ( )

getCookiesPath() публичный Метод

public getCookiesPath ( ) : string
Результат string

getCurrentUrl() публичный Метод

public getCurrentUrl ( ) : string
Результат string

getDefaultHttpOptions() защищенный Метод

protected getDefaultHttpOptions ( ) : array
Результат array

init() защищенный Метод

Initializes curl resource with options.
protected init ( string $url, string $postString, array $headers )
$url string
$postString string
$headers array

initCookieFile() защищенный Метод

Returns cookie file name by username. If username is empty we use a random cookie name, to be sure we have different cookies in parallel sessions.
protected initCookieFile ( string $username ) : string
$username string
Результат string

initCookieJar() защищенный Метод

Init cookie file for a specified username. If username is empty we use common cookie file for all sessions. If file does not exist it will be created in system temp directory.
protected initCookieJar ( $username = '' )
$username

loadCookies() публичный Метод

Load cookies for specified username
public loadCookies ( string $username = '' ) : seregazhuk\PinterestBot\Api\Contracts\HttpClient
$username string
Результат seregazhuk\PinterestBot\Api\Contracts\HttpClient

makeHttpOptions() защищенный Метод

Adds necessary curl options for query.
protected makeHttpOptions ( string $postString = '' ) : array
$postString string POST query string
Результат array

removeCookies() публичный Метод

public removeCookies ( )

setCookiesPath() публичный Метод

Set directory to store all cookie files.
public setCookiesPath ( string $path )
$path string

setOptions() публичный Метод

Set custom Curl options to override default
public setOptions ( array $options ) : seregazhuk\PinterestBot\Api\Contracts\HttpClient
$options array
Результат seregazhuk\PinterestBot\Api\Contracts\HttpClient

useProxy() публичный Метод

public useProxy ( string $host, string $port, string $auth = null, string $type = null ) : seregazhuk\PinterestBot\Api\Contracts\HttpClient
$host string '192.168.1.1'
$port string '12345'
$auth string Authentication string: 'username:password'
$type string HTTP|SOCKS
Результат seregazhuk\PinterestBot\Api\Contracts\HttpClient

useSocksProxy() публичный Метод

public useSocksProxy ( string $host, string $port, null $auth = null ) : seregazhuk\PinterestBot\Api\Contracts\HttpClient
$host string
$port string
$auth null
Результат seregazhuk\PinterestBot\Api\Contracts\HttpClient

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

$cookieJar защищенное свойство

Path to cookies file
protected string $cookieJar
Результат string

$cookies защищенное свойство

Cookies container
protected Cookies,seregazhuk\PinterestBot\Helpers $cookies
Результат seregazhuk\PinterestBot\Helpers\Cookies

$cookiesPath защищенное свойство

Path to directory to store cookie file
protected string $cookiesPath
Результат string

$curl защищенное свойство

Contains the curl instance.
protected resource $curl
Результат resource

$currentUrl защищенное свойство

protected string $currentUrl
Результат string

$headers защищенное свойство

protected array $headers
Результат array

$options защищенное свойство

Custom CURL options for requests.
protected array $options
Результат array