_response_to_rss

Retrieve.

Description

(MagpieRSS|bool) _response_to_rss( (array) $resp ); 

Returns (MagpieRSS|bool)

Parameters (1)

0. $resp (array)
The resp.

Usage

  1. if ( !function_exists( '_response_to_rss' ) ) { 
  2. require_once ABSPATH . WPINC . '/rss.php'; 
  3.  
  4. // The resp. 
  5. $resp = array(); 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = _response_to_rss($resp); 
  9.  

Defined (1)

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

/wp-includes/rss.php  
  1. function _response_to_rss ($resp) { 
  2. $rss = new MagpieRSS( $resp->results ); 
  3.  
  4. // if RSS parsed successfully 
  5. if ( $rss && (!isset($rss->ERROR) || !$rss->ERROR) ) { 
  6.  
  7. // find Etag, and Last-Modified 
  8. foreach ( (array) $resp->headers as $h) { 
  9. // 2003-03-02 - Nicola Asuni (www.tecnick.com) - fixed bug "Undefined offset: 1" 
  10. if (strpos($h, ": ")) { 
  11. list($field, $val) = explode(": ", $h, 2); 
  12. else { 
  13. $field = $h; 
  14. $val = ""; 
  15.  
  16. if ( $field == 'etag' ) { 
  17. $rss->etag = $val; 
  18.  
  19. if ( $field == 'last-modified' ) { 
  20. $rss->last_modified = $val; 
  21.  
  22. return $rss; 
  23. } // else constructerrormessage 
  24. else { 
  25. $errormsg = "Failed to parse RSS file."; 
  26.  
  27. if ($rss) { 
  28. $errormsg .= " (" . $rss->ERROR . ")"; 
  29. //error$errormsg); 
  30.  
  31. return false; 
  32. } // end if ($rss and !$rss->error)