Overview

Packages

  • Requests
    • Authentication
    • Cookies
    • Proxy
    • Session
    • Transport
    • Utilities

Classes

  • Requests_Transport_cURL
  • Requests_Transport_fsockopen

Interfaces

  • Requests_Transport
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated

Warning! You are currently reading the documentation for Requests 1.x.

It is recommended to upgrade to Requests 2.x at your earliest convenience. Upgrading to Requests 2.x is fairly straight-forward.
A full list of the changes can be found in the Changelog.

Visit the documentation for Requests_Transport_fsockopen in Requests 2.x.

Class Requests_Transport_fsockopen

fsockopen HTTP transport

Requests_Transport_fsockopen implements Requests_Transport
Package: Requests\Transport
Located at Requests/Transport/fsockopen.php
Methods summary
public string
# request( string $url, array $headers = array(), string|array $data = array(), array $options = array() )

Perform a request

Perform a request

Parameters

$url
URL to request
$headers
Associative array of request headers
$data
Data to send either as the POST body, or as parameters in the URL for a GET/HEAD
$options
Request options, see Requests::response() for documentation

Returns

string
Raw HTTP result

Throws

Requests_Exception
On failure to connect to socket (fsockopenerror)
Requests_Exception
On socket timeout (timeout)

Implementation of

Requests_Transport::request()
public array
# request_multiple( array $requests, array $options )

Send multiple requests simultaneously

Send multiple requests simultaneously

Parameters

$requests
Request data (array of 'url', 'headers', 'data', 'options') as per Requests_Transport::request()
$options
Global options, see Requests::response() for documentation

Returns

array
Array of Requests_Response objects (may contain Requests_Exception or string responses as well)

Implementation of

Requests_Transport::request_multiple()
protected static string
# accept_encoding( )

Retrieve the encodings we can accept

Retrieve the encodings we can accept

Returns

string
Accept-Encoding header value
protected static string
# format_get( array $url_parts, array|object $data )

Format a URL given GET data

Format a URL given GET data

Parameters

$url_parts
$data
Data to build query using, see https://secure.php.net/http_build_query

Returns

string
URL with data
public
# connect_error_handler( integer $errno, string $errstr )

Error handler for stream_socket_client()

Error handler for stream_socket_client()

Parameters

$errno
Error number (e.g. E_WARNING)
$errstr
Error message
public boolean
# verify_certificate_from_context( string $host, resource $context )

Verify the certificate against common name and subject alternative names

Verify the certificate against common name and subject alternative names

Unfortunately, PHP doesn't check the certificate against the alternative names, leading things like 'https://www.github.com/' to be invalid. Instead

Parameters

$host
Host name to verify against
$context
Stream context

Returns

boolean

Throws

Requests_Exception
On failure to connect via TLS (fsockopen.ssl.connect_error)
Requests_Exception
On not obtaining a match for the host (fsockopen.ssl.no_match)

See

https://tools.ietf.org/html/rfc2818#section-3.1 RFC2818, Section 3.1
public static boolean
# test( $capabilities = array() )

Whether this transport is valid

Whether this transport is valid

Returns

boolean
True if the transport is valid, false otherwise.

Codecoverageignore

Implementation of

Requests_Transport::test()
Constants summary
integer SECOND_IN_MICROSECONDS

Second to microsecond conversion

Second to microsecond conversion

# 1000000
Properties summary
public string $headers

Raw HTTP data

Raw HTTP data

# ''
public array $info

Stream metadata

Stream metadata

#
protected integer|boolean $max_bytes

What's the maximum number of bytes we should keep?

What's the maximum number of bytes we should keep?

# false
protected string $connect_error
# ''
Requests 1.8.1 API Documentation API documentation generated by ApiGen