WP_Importer::get_page( string $url, string $username = '', string $password = '', bool $head = false )

GET URL


Description Description


Parameters Parameters

$url

(string) (Required)

$username

(string) (Optional)

Default value: ''

$password

(string) (Optional)

Default value: ''

$head

(bool) (Optional)

Default value: false


Top ↑

Return Return

(array)


Top ↑

Source Source

File: wp-admin/includes/class-wp-importer.php

	public function get_page( $url, $username = '', $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 );
	}


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.