PHP Class seregazhuk\PinterestBot\Api\CurlHttpClient

Inheritance: implements seregazhuk\PinterestBot\Api\Contracts\HttpClient
Afficher le fichier Open project: seregazhuk/php-pinterest-bot

Protected Properties

Свойство Type Description
$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.

Méthodes publiques

Méthode Description
__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

Méthodes protégées

Méthode Description
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.

Method Details

__construct() public méthode

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

callCurl() protected méthode

protected callCurl ( ) : mixed
Résultat mixed

cookies() public méthode

Get all cookies
public cookies ( ) : array
Résultat array

execute() public méthode

Executes curl request.
public execute ( string $url, string $postString = '', array $headers = [] ) : string
$url string
$postString string
$headers array
Résultat string

fillCookies() protected méthode

protected fillCookies ( )

getCookiesPath() public méthode

public getCookiesPath ( ) : string
Résultat string

getCurrentUrl() public méthode

public getCurrentUrl ( ) : string
Résultat string

getDefaultHttpOptions() protected méthode

protected getDefaultHttpOptions ( ) : array
Résultat array

init() protected méthode

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

initCookieFile() protected méthode

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
Résultat string

initCookieJar() protected méthode

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() public méthode

Load cookies for specified username
public loadCookies ( string $username = '' ) : seregazhuk\PinterestBot\Api\Contracts\HttpClient
$username string
Résultat seregazhuk\PinterestBot\Api\Contracts\HttpClient

makeHttpOptions() protected méthode

Adds necessary curl options for query.
protected makeHttpOptions ( string $postString = '' ) : array
$postString string POST query string
Résultat array

removeCookies() public méthode

public removeCookies ( )

setCookiesPath() public méthode

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

setOptions() public méthode

Set custom Curl options to override default
public setOptions ( array $options ) : seregazhuk\PinterestBot\Api\Contracts\HttpClient
$options array
Résultat seregazhuk\PinterestBot\Api\Contracts\HttpClient

useProxy() public méthode

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
Résultat seregazhuk\PinterestBot\Api\Contracts\HttpClient

useSocksProxy() public méthode

public useSocksProxy ( string $host, string $port, null $auth = null ) : seregazhuk\PinterestBot\Api\Contracts\HttpClient
$host string
$port string
$auth null
Résultat seregazhuk\PinterestBot\Api\Contracts\HttpClient

Property Details

$cookieJar protected_oe property

Path to cookies file
protected string $cookieJar
Résultat string

$cookies protected_oe property

Cookies container
protected Cookies,seregazhuk\PinterestBot\Helpers $cookies
Résultat seregazhuk\PinterestBot\Helpers\Cookies

$cookiesPath protected_oe property

Path to directory to store cookie file
protected string $cookiesPath
Résultat string

$curl protected_oe property

Contains the curl instance.
protected resource $curl
Résultat resource

$currentUrl protected_oe property

protected string $currentUrl
Résultat string

$headers protected_oe property

protected array $headers
Résultat array

$options protected_oe property

Custom CURL options for requests.
protected array $options
Résultat array