WPCF7_Service_OAuth2::remote_request()protectedCF7 1.0

Метод класса: WPCF7_Service_OAuth2{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->remote_request( $url, $request );
$url (обязательный)
-
$request **
-
По умолчанию: array()

Код WPCF7_Service_OAuth2::remote_request() CF7 5.9.3

protected function remote_request( $url, $request = array() ) {
	static $refreshed = false;

	$request = wp_parse_args( $request, array() );

	$request['headers'] = array_merge(
		$request['headers'],
		array(
			'Authorization' => $this->get_http_authorization_header( 'bearer' ),
		)
	);

	$response = wp_remote_request( sanitize_url( $url ), $request );

	if ( 401 === wp_remote_retrieve_response_code( $response )
	and ! $refreshed ) {
		$this->refresh_token();
		$refreshed = true;

		$response = $this->remote_request( $url, $request );
	}

	return $response;
}