PDA

View Full Version : How to display blog RSS in a non-vb page


beiamerica
02-01-2011, 07:14 PM
I am looking to display my blog RSS on my personal website via javascript or php. I have searched, but haven't found any code to do this like you can with the forum RSS.

Does anyone do this on their non-vb page, or know how to?

your24hourstore
02-02-2011, 02:09 PM
you may use curl. something like this
# INSTANTIATE CURL.
$curl = curl_init();

# CURL SETTINGS.
curl_setopt($curl, CURLOPT_URL, "http://www.musiciansgazette.com/blog_external.php?type=RSS2");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 0);

# GRAB THE XML FILE.
$xmlproduct-vbblog = curl_exec($curl);

curl_close($curl);

# SET UP XML OBJECT.
$xmlObjproduct-vbblog = simplexml_load_string( $xmlproduct-vbblog );

$tempCounter = 0;

foreach ( $xmlObjproduct-vbblog -> item as $item )
{
# DISPLAY ONLY 10 ITEMS.
if ( $tempCounter < 11 )
{
echo "<li><a href=\"{$item -> guid}\">{$item -> title}</a></li>
";
}

$tempCounter += 1;
}