wp_remote_fopen( string $uri )

HTTP request for URI to retrieve content.


Description Description

See also See also


Top ↑

Parameters Parameters

$uri

(string) (Required) URI/URL of web page to retrieve.


Top ↑

Return Return

(string|false) HTTP content. False on failure.


Top ↑

More Information More Information

See Plugin Handbook: HTTP API


Top ↑

Source Source

File: wp-includes/functions.php

function wp_remote_fopen( $uri ) {
	$parsed_url = @parse_url( $uri );

	if ( ! $parsed_url || ! is_array( $parsed_url ) ) {
		return false;
	}

	$options            = array();
	$options['timeout'] = 10;

	$response = wp_safe_remote_get( $uri, $options );

	if ( is_wp_error( $response ) ) {
		return false;
	}

	return wp_remote_retrieve_body( $response );
}


Top ↑

Changelog Changelog

Changelog
Version Description
1.5.1 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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