HTTP请求URI以检索内容。
原型
wp_remote_fopen( string $uri )
参数
$uri
(string)
(Required)
要检索的网页的URI / URL。
返回值
(false|string)
HTTP内容。失败时是假的。
源文件
路径:wp-includes/functions.php
<?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 );
}
...
?>
其他
英文文档:https://developer.wordpress.org/reference/functions/wp_remote_fopen/