URLConnection

php\net\URLConnection

Class URLConnection

Properties


property doOutput

bool

property doInput

bool

property requestMethod

string

POST, GET, PUT, etc.

property connectTimeout

php\net\int millis

that specifies the connect timeout value in milliseconds

property readTimeout

php\net\int millis

the read timeout to a specified timeout, in milliseconds.

property useCaches

bool

property ifModifiedSince

php\net\int millis

property followRedirects

bool

property url

php\net\URL

read-only

property responseCode

int

read-only

property responseMessage

int

read-only

property contentLength

php\net\int bytes

read-only

int the content length of the resource that this connection’s URL references, -1 if the content length is not known, or if the content length is greater than Integer.MAX_VALUE.

property contentType

string

read-only

property contentEncoding

string

read-only

property expiration

int

read-only

property lastModified

int

read-only

property usingProxy

bool

read-only

Methods


__construct($parent)

protected

Parameters:
connect()
getHeaderField($name)
Parameters:
  • $namestring
getHeaderFields()
Returns:array
getInputStream()
Returns:php\io\Stream
getErrorStream()
Returns:php\io\Stream
getOutputStream()
Returns:php\io\Stream
setRequestProperty($name, $value)
Parameters:
  • $namestring
  • $valuestring
getRequestProperty($name)
Parameters:
  • $namestring
getRequestProperties()
Returns:array
disconnect()
setChunkedStreamingMode($chunklen)

This method is used to enable streaming of a HTTP request body without internal buffering, when the content length is <b>not</b> known in advance. In this mode, chunked transfer encoding is used to send the request body. Note, not all HTTP servers support this mode.

Parameters:
  • $chunklenint - The number of bytes to write in each chunk.

If chunklen is less than or equal to zero, a default value will be used.

static guessContentTypeFromStream($stream)

Tries to determine the type of an input stream based on the characters at the beginning of the input stream. This method can be used by subclasses that override the <code>getContentType</code> method.

Parameters:
Returns:

string

static guessContentTypeFromName($name)
Parameters:
  • $namestring
static create($url, $proxy = null)
Parameters:
Returns:

php\net\URLConnection