HTTP request for URI to retrieve content.
$uristringrequired
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 );
}
| Version | Description |
|---|---|
| 1.5.1 | Introduced. |
© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_remote_fopen