_response_to_rss

Definition:
function _response_to_rss ($resp) {}

Retrieve

Parameters

  • unknown_type $resp

Source code

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)

}

4365

Advertisements

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: