PHP Класс Curl\Curl

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

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

Свойство Тип Описание
$RFC2616
$RFC6265
$baseUrl
$beforeSendFunction
$completeFunction
$curl
$curlError
$curlErrorCode
$curlErrorMessage
$downloadCompleteFunction
$error
$errorCode
$errorFunction
$errorMessage
$fileHandle
$httpError
$httpErrorMessage
$httpStatusCode
$id
$rawResponse
$rawResponseHeaders
$requestHeaders
$response
$responseCookies
$responseHeaders
$successFunction
$url

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

Метод Описание
__construct ( $base_url = null ) Construct
__destruct ( ) Destruct
__get ( $name )
array_flatten_multidim ( $array, $prefix = false ) : array Array Flatten Multidim
beforeSend ( $callback ) Before Send
buildPostData ( $data ) : array | string Build Post Data
call ( ) Call
close ( ) Close
complete ( $callback ) Complete
delete ( $url, $query_parameters = [], $data = [] ) : string Delete
download ( $url, $mixed_filename ) : boolean Download
error ( $callback ) Error
exec ( $ch = null ) : mixed Exec
get ( $url, $data = [] ) : mixed Get
getCookie ( $key ) : mixed Get Cookie
getInfo ( $opt = null ) : mixed Get Info
getOpt ( $option ) : mixed Get Opt
getResponseCookie ( $key ) : mixed Get Response Cookie
head ( $url, $data = [] ) : string Head
headerCallback ( $ch, $header ) : integer Header Callback
is_array_assoc ( $array ) : boolean Is Array Assoc
is_array_multidim ( $array ) : boolean Is Array Multidim
options ( $url, $data = [] ) : string Options
patch ( $url, $data = [] ) : string Patch
post ( $url, $data = [], $follow_303_with_post = false ) : string Post
progress ( $callback ) Progress
put ( $url, $data = [] ) : string Put
removeHeader ( $key ) Remove Header
search ( $url, $data = [] ) : string Search
setBasicAuthentication ( $username, $password = '' ) Set Basic Authentication
setConnectTimeout ( $seconds ) Set Connect Timeout
setCookie ( $key, $value ) Set Cookie
setCookieFile ( $cookie_file ) Set Cookie File
setCookieJar ( $cookie_jar ) Set Cookie Jar
setCookieString ( $string ) : boolean Set Cookie String
setDefaultDecoder ( $decoder = 'json' ) Set Default Decoder
setDefaultJsonDecoder ( ) Set Default JSON Decoder
setDefaultTimeout ( ) Set Default Timeout
setDefaultUserAgent ( ) Set Default User Agent
setDefaultXmlDecoder ( ) Set Default XML Decoder
setDigestAuthentication ( $username, $password = '' ) Set Digest Authentication
setHeader ( $key, $value ) Set Header
setHeaders ( $headers ) Set Headers
setJsonDecoder ( $function ) Set JSON Decoder
setMaxFilesize ( $bytes ) Set Max Filesize
setOpt ( $option, $value ) : boolean Set Opt
setOpts ( $options ) : boolean Set Opts
setPort ( $port ) Set Port
setReferer ( $referer ) Set Referer
setReferrer ( $referrer ) Set Referrer
setTimeout ( $seconds ) Set Timeout
setUrl ( $url, $data = [] ) Set Url
setUserAgent ( $user_agent ) Set User Agent
setXmlDecoder ( $function ) Set XML Decoder
success ( $callback ) Success
unsetHeader ( $key ) Unset Header
verbose ( boolean $on = true, resource $output = STDERR ) Verbose

Приватные методы

Метод Описание
__get_effectiveUrl ( ) Get Effective Url
__get_rfc2616 ( ) Get RFC 2616
__get_rfc6265 ( ) Get RFC 6265
__get_totalTime ( ) Get Total Time
buildURL ( $url, $data = [] ) : string Build Url
downloadComplete ( $fh ) Download Complete
parseHeaders ( $raw_headers ) : array Parse Headers
parseRequestHeaders ( $raw_headers ) : array Parse Request Headers
parseResponse ( $response_headers, $raw_response ) : mixed Parse Response
parseResponseHeaders ( $raw_response_headers ) : array Parse Response Headers

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

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

Construct
public __construct ( $base_url = null )
$base_url

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

Destruct
public __destruct ( )

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

public __get ( $name )

array_flatten_multidim() публичный статический Метод

Array Flatten Multidim
public static array_flatten_multidim ( $array, $prefix = false ) : array
$array
$prefix
Результат array

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

Before Send
public beforeSend ( $callback )
$callback

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

Build Post Data
public buildPostData ( $data ) : array | string
$data
Результат array | string

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

Call
public call ( )

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

Close
public close ( )

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

Complete
public complete ( $callback )
$callback

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

Delete
public delete ( $url, $query_parameters = [], $data = [] ) : string
$url
$query_parameters
$data
Результат string

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

Download
public download ( $url, $mixed_filename ) : boolean
$url
$mixed_filename
Результат boolean

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

Error
public error ( $callback )
$callback

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

Exec
public exec ( $ch = null ) : mixed
$ch
Результат mixed Returns the value provided by parseResponse.

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

Get
public get ( $url, $data = [] ) : mixed
$url
$data
Результат mixed Returns the value provided by exec.

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

Get Cookie
public getCookie ( $key ) : mixed
$key
Результат mixed

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

Get Info
public getInfo ( $opt = null ) : mixed
$opt
Результат mixed

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

Get Opt
public getOpt ( $option ) : mixed
$option
Результат mixed

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

Get Response Cookie
public getResponseCookie ( $key ) : mixed
$key
Результат mixed

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

Head
public head ( $url, $data = [] ) : string
$url
$data
Результат string

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

Header Callback
public headerCallback ( $ch, $header ) : integer
$ch
$header
Результат integer

is_array_assoc() публичный статический Метод

Is Array Assoc
public static is_array_assoc ( $array ) : boolean
$array
Результат boolean

is_array_multidim() публичный статический Метод

Is Array Multidim
public static is_array_multidim ( $array ) : boolean
$array
Результат boolean

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

Options
public options ( $url, $data = [] ) : string
$url
$data
Результат string

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

Patch
public patch ( $url, $data = [] ) : string
$url
$data
Результат string

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

Post
public post ( $url, $data = [], $follow_303_with_post = false ) : string
$url
$data
$follow_303_with_post If true, will cause 303 redirections to be followed using a POST request (default: false). Notes: - Redirections are only followed if the CURLOPT_FOLLOWLOCATION option is set to true. - According to the HTTP specs (see [1]), a 303 redirection should be followed using the GET method. 301 and 302 must not. - In order to force a 303 redirection to be performed using the same method, the underlying cURL object must be set in a special state (the CURLOPT_CURSTOMREQUEST option must be set to the method to use after the redirection). Due to a limitation of the cURL extension of PHP < 5.5.11 ([2], [3]) and of HHVM, it is not possible to reset this option. Using these PHP engines, it is therefore impossible to restore this behavior on an existing php-curl-class Curl object.
Результат string [1] https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.2 [2] https://github.com/php/php-src/pull/531 [3] http://php.net/ChangeLog-5.php#5.5.11

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

Progress
public progress ( $callback )
$callback

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

Put
public put ( $url, $data = [] ) : string
$url
$data
Результат string

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

Remove an internal header from the request. Using `curl -H "Host:" ...' is equivalent to $curl->removeHeader('Host');.
public removeHeader ( $key )
$key

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

Set Basic Authentication
public setBasicAuthentication ( $username, $password = '' )
$username
$password

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

Set Connect Timeout
public setConnectTimeout ( $seconds )
$seconds

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

Set Cookie
public setCookie ( $key, $value )
$key
$value

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

Set Cookie File
public setCookieFile ( $cookie_file )
$cookie_file

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

Set Cookie Jar
public setCookieJar ( $cookie_jar )
$cookie_jar

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

Set Cookie String
public setCookieString ( $string ) : boolean
$string
Результат boolean

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

Set Default Decoder
public setDefaultDecoder ( $decoder = 'json' )
$decoder string|callable

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

Set Default JSON Decoder

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

Set Default Timeout
public setDefaultTimeout ( )

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

Set Default User Agent
public setDefaultUserAgent ( )

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

Set Default XML Decoder

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

Set Digest Authentication
public setDigestAuthentication ( $username, $password = '' )
$username
$password

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

Add extra header to include in the request.
public setHeader ( $key, $value )
$key
$value

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

Add extra headers to include in the request.
public setHeaders ( $headers )
$headers

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

Set JSON Decoder
public setJsonDecoder ( $function )
$function

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

Set Max Filesize
public setMaxFilesize ( $bytes )
$bytes

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

Set Opt
public setOpt ( $option, $value ) : boolean
$option
$value
Результат boolean

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

Set Opts
public setOpts ( $options ) : boolean
$options
Результат boolean Returns true if all options were successfully set. If an option could not be successfully set, false is immediately returned, ignoring any future options in the options array. Similar to curl_setopt_array().

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

Set Port
public setPort ( $port )
$port

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

Set Referer
public setReferer ( $referer )
$referer

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

Set Referrer
public setReferrer ( $referrer )
$referrer

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

Set Timeout
public setTimeout ( $seconds )
$seconds

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

Set Url
public setUrl ( $url, $data = [] )
$url
$data

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

Set User Agent
public setUserAgent ( $user_agent )
$user_agent

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

Set XML Decoder
public setXmlDecoder ( $function )
$function

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

Success
public success ( $callback )
$callback

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

Remove extra header previously set using Curl::setHeader().
public unsetHeader ( $key )
$key

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

Verbose
public verbose ( boolean $on = true, resource $output = STDERR )
$on boolean
$output resource

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

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

public static $RFC2616

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

public static $RFC6265

$baseUrl публичное свойство

public $baseUrl

$beforeSendFunction публичное свойство

public $beforeSendFunction

$completeFunction публичное свойство

public $completeFunction

$curl публичное свойство

public $curl

$curlError публичное свойство

public $curlError

$curlErrorCode публичное свойство

public $curlErrorCode

$curlErrorMessage публичное свойство

public $curlErrorMessage

$downloadCompleteFunction публичное свойство

public $downloadCompleteFunction

$error публичное свойство

public $error

$errorCode публичное свойство

public $errorCode

$errorFunction публичное свойство

public $errorFunction

$errorMessage публичное свойство

public $errorMessage

$fileHandle публичное свойство

public $fileHandle

$httpError публичное свойство

public $httpError

$httpErrorMessage публичное свойство

public $httpErrorMessage

$httpStatusCode публичное свойство

public $httpStatusCode

$id публичное свойство

public $id

$rawResponse публичное свойство

public $rawResponse

$rawResponseHeaders публичное свойство

public $rawResponseHeaders

$requestHeaders публичное свойство

public $requestHeaders

$response публичное свойство

public $response

$responseCookies публичное свойство

public $responseCookies

$responseHeaders публичное свойство

public $responseHeaders

$successFunction публичное свойство

public $successFunction

$url публичное свойство

public $url