wpseek.com
Un motore di ricerca WordPress per sviluppatori e autori di temi



wp_remote_fopen › WordPress Function

Da1.5.1
Deprecaton/a
wp_remote_fopen ( $uri )
Parametri:
  • (string) $uri URI/URL of web page to retrieve.
    Richiesto:
Vedi:
Ritorna:
  • (string|false) HTTP content. False on failure.
Definito a:
Codex:

HTTP request for URI to retrieve content.



Sorgenti

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