stats_get_remote_csv

Stats get remote CSV.

Description

stats_get_remote_csv( $url ); 

Parameters (1)

0. $url
The url.

Usage

  1. if ( !function_exists( 'stats_get_remote_csv' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'jetpack-by-wordpress-com/modules/stats.php'; 
  3.  
  4. // The url. 
  5. $url = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = stats_get_remote_csv($url); 
  9.  

Defined (1)

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

/modules/stats.php  
  1. function stats_get_remote_csv( $url ) { 
  2. $method = 'GET'; 
  3. $timeout = 90; 
  4. $user_id = JETPACK_MASTER_USER
  5.  
  6. $get = Jetpack_Client::remote_request( compact( 'url', 'method', 'timeout', 'user_id' ) ); 
  7. $get_code = wp_remote_retrieve_response_code( $get ); 
  8. if ( is_wp_error( $get ) || ( 2 != intval( $get_code / 100 ) && 304 != $get_code ) || empty( $get['body'] ) ) { 
  9. return array(); // @todo: return an error? 
  10. } else { 
  11. return stats_str_getcsv( $get['body'] );