$ch = curl_init("http://buzzlog.buzz.yahoo.com/feeds/buzzsportm.xml");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, 0);
$data = curl_exec($ch);
curl_close($ch);
$doc = new SimpleXmlElement($data, LIBXML_NOCDATA);
//print_r($doc);
if(isset($doc->channel))
{ parseRSS($doc);
}
if(isset($doc->entry))
{ parseAtom($doc);
}
function parseRSS($xml)
{
echo "<strong>".$xml->channel->title."</strong>";
$cnt = count($xml->channel->item);
for($i=0; $i<$cnt; $i++)
{
$url = $xml->channel->item[$i]->link;
$title = $xml->channel->item[$i]->title;
$title = stripslashes($title);
$title = strip_tags($title);
$title = ereg_replace("[^A-Z a-z]", "", $title);
$desc = $xml->channel->item[$i]->description;
echo '<a href="'.$url.'"></br>'.$title.'</a> '.$desc.'</br>';
}
// Connect to your MySQL database whatever way you like to here
include_once "connect_to_mysql.php";
$url = $_POST["link"];
$title = $_POST["title"];
$desc = $_POST["description"];
// Database duplicate e-mail check setup for use below in the error handling if else conditionals
$sql = mysql_query("SELECT Full_Name FROM stock_index WHERE Full_Name='$Full_Name'");
$results = mysql_num_rows($sql);
$Current_Value = $row["Current_Value"];
if ($title != $Full_Name) {
print 'error';
}else{
print $Full_Name;
}
}
?>
|