SimplePie 1.3.1 is now available. Upgrade now!

SimplePie Documentation.  Learn how to use this thing.  It's way better than going to school.

You are here: Documentation » API Reference » SimplePie » set_useragent()

set_useragent()

Description

class SimplePie {
	set_useragent ( [string $ua = SIMPLEPIE_USERAGENT] )
}

Allows you to override the user agent string that SimplePie sends to the remote server. This value is passed directly to SimplePie_File.

Availability

  • Available since SimplePie 1.0.

Parameters

ua

A new user agent string for SimplePie to use. Defaults to SIMPLEPIE_USERAGENT.

Examples

Prepend 'Mozilla/4.0' to the existing user agent string

$feed = new SimplePie();
$feed->set_feed_url('http://simplepie.org/blog/feed/');
$feed->set_useragent('Mozilla/4.0 '.SIMPLEPIE_USERAGENT);
$feed->init();
$feed->handle_content_type();
echo $feed->get_title();

See Also


reference/simplepie/set_useragent.txt · Last modified: 2011/03/05 19:56 (external edit)