WP_Importer::get_pagepublicWP 1.0

Gets URL.

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

Хуков нет.

Возвращает

Массив.

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

$WP_Importer = new WP_Importer();
$WP_Importer->get_page( $url, $username, $password, $head );
$url(строка) (обязательный)
.
$username(строка)
.
По умолчанию: ''
$password(строка)

.

Иммет атрибут #[\SensitiveParameter], который скрывает значение параметра из логов. Используется для защиты чувствительных данных (например, паролей). Документация.

По умолчанию: ''

$head(true|false)
.
По умолчанию: false

Код WP_Importer::get_page() WP 7.0.1

public function get_page(
	$url,
	$username = '',
	#[\SensitiveParameter]
	$password = '',
	$head = false
) {
	// Increase the timeout.
	add_filter( 'http_request_timeout', array( $this, 'bump_request_timeout' ) );

	$headers = array();
	$args    = array();
	if ( true === $head ) {
		$args['method'] = 'HEAD';
	}
	if ( ! empty( $username ) && ! empty( $password ) ) {
		$headers['Authorization'] = 'Basic ' . base64_encode( "$username:$password" );
	}

	$args['headers'] = $headers;

	return wp_safe_remote_request( $url, $args );
}