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¶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:
- $parent – php\net\URLConnection
connect()¶
getHeaderField($name)¶
Parameters:
- $name – string
getHeaderFields()¶
Returns: array
getInputStream()¶
Returns: php\io\Stream
getErrorStream()¶
Returns: php\io\Stream
getOutputStream()¶
Returns: php\io\Stream
setRequestProperty($name, $value)¶
Parameters:
- $name – string
- $value – string
getRequestProperty($name)¶
Parameters:
- $name – string
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:
- $chunklen – int - 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:
- $stream – php\io\Stream
Returns: string
- static
guessContentTypeFromName($name)¶
Parameters:
- $name – string
- static
create($url, $proxy = null)¶
Parameters:
- $url – string
- $proxy – php\net\Proxy
Returns: