Title: _response_to_rss
Published: April 25, 2014
Last modified: May 20, 2026

---

# _response_to_rss( array $resp ): 󠀁[MagpieRSS](https://developer.wordpress.org/reference/classes/magpierss/)󠁿|bool

## In this article

 * [Parameters](https://developer.wordpress.org/reference/functions/_response_to_rss/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/_response_to_rss/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/_response_to_rss/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/_response_to_rss/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/_response_to_rss/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/_response_to_rss/?output_format=md#wp--skip-link--target)

Retrieve

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/_response_to_rss/?output_format=md#parameters)󠁿

 `$resp`arrayrequired

## 󠀁[Return](https://developer.wordpress.org/reference/functions/_response_to_rss/?output_format=md#return)󠁿

 [MagpieRSS](https://developer.wordpress.org/reference/classes/magpierss/)|bool

## 󠀁[Source](https://developer.wordpress.org/reference/functions/_response_to_rss/?output_format=md#source)󠁿

    ```php
    function _response_to_rss ($resp) {
    	$rss = new MagpieRSS( $resp->results );

    	// if RSS parsed successfully
    	if ( $rss && (!isset($rss->ERROR) || !$rss->ERROR) ) {

    		// find Etag, and Last-Modified
    		foreach ( (array) $resp->headers as $h) {
    			// 2003-03-02 - Nicola Asuni (www.tecnick.com) - fixed bug "Undefined offset: 1"
    			if (strpos($h, ": ")) {
    				list($field, $val) = explode(": ", $h, 2);
    			}
    			else {
    				$field = $h;
    				$val = "";
    			}

    			if ( $field == 'etag' ) {
    				$rss->etag = $val;
    			}

    			if ( $field == 'last-modified' ) {
    				$rss->last_modified = $val;
    			}
    		}

    		return $rss;
    	} // else construct error message
    	else {
    		$errormsg = "Failed to parse RSS file.";

    		if ($rss) {
    			$errormsg .= " (" . $rss->ERROR . ")";
    		}
    		// error($errormsg);

    		return false;
    	} // end if ($rss and !$rss->error)
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/rss.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/rss.php#L593)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/rss.php#L593-L631)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/_response_to_rss/?output_format=md#related)󠁿

| Uses | Description | 
| [MagpieRSS::__construct()](https://developer.wordpress.org/reference/classes/magpierss/__construct/)`wp-includes/rss.php` |

PHP5 constructor.

  |

| Used by | Description | 
| [fetch_rss()](https://developer.wordpress.org/reference/functions/fetch_rss/)`wp-includes/rss.php` |

Build Magpie object based on RSS from URL.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/_response_to_rss/?output_format=md#changelog)󠁿

| Version | Description | 
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2F_response_to_rss%2F)
before being able to contribute a note or feedback.