Parse PHP SDK API Reference

ParseCurlHttpClient
in package
implements ParseHttpable

Class ParseCurlHttpClient - Curl http client

Tags
author

Ben Friedman [email protected]

Interfaces, Classes and Traits

ParseHttpable
Class ParseHttpable - Interface for an HTTPable client

Table of Contents

CONNECTION_ESTABLISHED  = "HTTP/1.0 200 Connection established "
CURL_PROXY_QUIRK_VER  = 0x71e00
$curlErrorCode  : int
cURL error code
$curlErrorMessage  : string
cURL error message
$headers  : array<string|int, mixed>
Request Headers
$parseCurl  : ParseCurl
Curl handle
$response  : string
Response from our request
$responseCode  : int
Response code
$responseContentType  : string|null
Content type of our response
$responseHeaders  : array<string|int, mixed>
Response headers
__construct()  : mixed
ParseCurlHttpClient constructor.
addRequestHeader()  : mixed
Adds a header to this request
getErrorCode()  : int
Gets the error code
getErrorMessage()  : string
Gets the error message
getResponseContentType()  : null|string
Returns the content type of the response
getResponseHeaders()  : array<string|int, mixed>
Gets headers in the response
getResponseStatusCode()  : int
Returns the status code of the response
send()  : string
Sends an HTTP request
setCAFile()  : mixed
Sets the CA file to validate requests with
setConnectionTimeout()  : mixed
Sets the connection timeout
setHttpOptions()  : mixed
Sets multiple curl options https://www.php.net/manual/en/function.curl-setopt.php
setTimeout()  : mixed
Sets the request timeout
setup()  : void
Sets up our cURL request in advance
buildRequestHeaders()  : array<string|int, mixed>
Builds and returns the coalesced request headers
getHeadersArray()  : array<string|int, mixed>
Convert and return response headers as an array
getHeaderSize()  : int
Return proper header size
needsCurlProxyFix()  : bool
Detect versions of Curl which report incorrect header lengths when using Proxies.

Constants

CONNECTION_ESTABLISHED

public mixed CONNECTION_ESTABLISHED = "HTTP/1.0 200 Connection established "
Tags
const

"Connection Established" header text

CURL_PROXY_QUIRK_VER

public mixed CURL_PROXY_QUIRK_VER = 0x71e00
Tags
const

Curl Version which is unaffected by the proxy header length error.

Properties

$responseContentType

Content type of our response

private string|null $responseContentType

$responseHeaders

Response headers

private array<string|int, mixed> $responseHeaders = array()

Methods

__construct()

ParseCurlHttpClient constructor.

public __construct() : mixed
Return values
mixed

addRequestHeader()

Adds a header to this request

public addRequestHeader(string $key, string $value) : mixed
Parameters
$key : string

Header name

$value : string

Header value

Return values
mixed

getErrorCode()

Gets the error code

public getErrorCode() : int
Return values
int

getErrorMessage()

Gets the error message

public getErrorMessage() : string
Return values
string

getResponseContentType()

Returns the content type of the response

public getResponseContentType() : null|string
Return values
null|string

getResponseHeaders()

Gets headers in the response

public getResponseHeaders() : array<string|int, mixed>
Return values
array<string|int, mixed>

getResponseStatusCode()

Returns the status code of the response

public getResponseStatusCode() : int
Return values
int

send()

Sends an HTTP request

public send(string $url[, string $method = 'GET' ][, array<string|int, mixed> $data = array() ]) : string
Parameters
$url : string

Url to send this request to

$method : string = 'GET'

Method to send this request via

$data : array<string|int, mixed> = array()

Data to send in this request

Tags
throws
ParseException
Return values
string

setCAFile()

Sets the CA file to validate requests with

public setCAFile(string $caFile) : mixed
Parameters
$caFile : string

CA file to set

Return values
mixed

setConnectionTimeout()

Sets the connection timeout

public setConnectionTimeout(int $timeout) : mixed
Parameters
$timeout : int

Timeout to set

Return values
mixed

setHttpOptions()

Sets multiple curl options https://www.php.net/manual/en/function.curl-setopt.php

public setHttpOptions(array<string|int, mixed> $options) : mixed
Parameters
$options : array<string|int, mixed>

Array of options to set

Tags
throws
ParseException
Return values
mixed

setTimeout()

Sets the request timeout

public setTimeout(int $timeout) : mixed
Parameters
$timeout : int

Sets the timeout for the request

Return values
mixed

setup()

Sets up our cURL request in advance

public setup() : void
Return values
void

buildRequestHeaders()

Builds and returns the coalesced request headers

private buildRequestHeaders() : array<string|int, mixed>
Return values
array<string|int, mixed>

getHeadersArray()

Convert and return response headers as an array

private getHeadersArray(string $headerContent) : array<string|int, mixed>
Parameters
$headerContent : string

Raw headers to parse

Return values
array<string|int, mixed>

getHeaderSize()

Return proper header size

private getHeaderSize() : int
Return values
int

needsCurlProxyFix()

Detect versions of Curl which report incorrect header lengths when using Proxies.

private needsCurlProxyFix() : bool
Return values
bool

Search results