wp_remote_fopen

HTTP request for URI to retrieve content.

Description

(false|string) wp_remote_fopen( (string) $uri ); 

Returns (false|string)

HTTP content. False on failure.

Parameters (1)

0. $uri (string)
URI/URL of web page to retrieve.

Usage

  1. if ( !function_exists( 'wp_remote_fopen' ) ) { 
  2. require_once ABSPATH . WPINC . '/functions.php'; 
  3.  
  4. // URI/URL of web page to retrieve. 
  5. $uri = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wp_remote_fopen($uri); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/functions.php  
  1. function wp_remote_fopen( $uri ) { 
  2. $parsed_url = @parse_url( $uri ); 
  3.  
  4. if ( !$parsed_url || !is_array( $parsed_url ) ) 
  5. return false; 
  6.  
  7. $options = array(); 
  8. $options['timeout'] = 10; 
  9.  
  10. $response = wp_safe_remote_get( $uri, $options ); 
  11.  
  12. if ( is_wp_error( $response ) ) 
  13. return false; 
  14.  
  15. return wp_remote_retrieve_body( $response );