Requests_Session::__construct() WordPress Method

This function initializes a new session and sets the default values. It also parses the headers if they haven't been parsed yet and sets the user-agent header to the default value if it hasn't been set yet.

Requests_Session::__construct( string|null $url = null, array $headers = array(), array $data = array(), array $options = array() ) #

Create a new session


Parameters

$url

(string|null)(Optional)Base URL for requests

Default value: null

$headers

(array)(Optional)Default headers for requests

Default value: array()

$data

(array)(Optional)Default data for requests

Default value: array()

$options

(array)(Optional)Default options for requests

Default value: array()


Top ↑

Source

File: wp-includes/Requests/Session.php

68
69
70
71
72
73
74
75
76
77
public function __construct($url = null, $headers = array(), $data = array(), $options = array()) {
    $this->url     = $url;
    $this->headers = $headers;
    $this->data    = $data;
    $this->options = $options;
 
    if (empty($this->options['cookies'])) {
        $this->options['cookies'] = new Requests_Cookie_Jar();
    }
}

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by the Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.