WP_Importer::get_page

Advertisement

Summery Summery

GET URL

Syntax Syntax

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

Parameters Parameters

$url

(string) (Required)

$username

(string) (Optional)

Default value: ''

$password

(string) (Optional)

Default value: ''

$head

(bool) (Optional)

Default value: false

Return Return

(array)

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 );
	}

Advertisement

Advertisement

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.