...

View Full Version : google news feed xml error



lorenya
10-27-2008, 09:19 PM
I have several minisites that were working fine until today. However, suddenly all my sites have the same error XML error: > required at line 14. I am hosting at Godaddy. Sites have titles and ads at the top but nothing else, no news feed. There is no line 14 at neither config nor index.php to insert > mark.
Please advice how all sites give this same error, where does this error come from and how can it be solved. Your urgent help will be appreciated. thnx.

jamesicus
10-27-2008, 10:18 PM
Could you provide a URI?

James

lorenya
10-27-2008, 10:39 PM
All the codes are as below. This is just a Quick mini site.


<?php
include("config.php");
if (empty($title)) { $title = $_SERVER['HTTP_HOST']; }
$feed = "http://news.google.com/news?q=$keyword&ie=UTF-8&output=rss";
if (empty($keyword))
{ $feed = "http://news.google.com/nwshp?ie=UTF-8&oe=UTF-8&hl=en&tab=wn&q=&output=rss"; }
$keyword2 = ucfirst($keyword);
if (empty($keyword2))
{ $keyword2 = "World"; }
$feed = str_replace (" ", "+", $feed);
?>









<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type" />
<title><?php echo ucfirst($title); ?> - <?php echo "The Latest $keyword2 News and Information" ?></title>


<style type="text/css">
* {
margin: 0px;
}
/* Global Elements */
body {
background: #F0F8FA;
font: 0.75em Arial;
color: #<?php echo $text_color; ?>;
text-align: center;
}
fieldset {
border: 0px;
padding: 0px;
}
form {
padding: 0px;
}



#ttext
{
font-weight: none;
text-transform: uppercase;
text-decoration: none;
}

#ttext a {
text-decoration: none;
font-weight: none;
}

#ttext a:hover {
text-decoration: none;
font-weight: none;
}


a {
color: #<?php echo $link_color; ?>;
}
a:hover {
text-decoration: none;
}
.clear {
clear: both;
height: 0&#37;;
font-size: 0%;
}
/* Top container */
#container {
width: 769px;
margin: 20px auto 20px auto;
text-align: left;
background: url(images/container_bg.gif) repeat-y center;
}
#content {
padding: 24px 20px 0px 21px;
background: url(images/top.gif) no-repeat;
}
/* Heading */
#title {
background: url(images/gradient.gif) repeat-x;
height: 95px;
padding: 0px 20px 0px 23px;;
}
#title h1 {
font: 2.0em Georgia;
color: #<?php echo $link_color; ?>;
padding: 30px 0px;
float: left;
}

/* Search Box */
#search {
float: right;
color: #<?php echo $text_color; ?>;
width: 240px;
font-size: 0.9em;
padding-top: 25px;
}
#search .label {
margin-top: 10px;
display: block;
float: left;
width: 60px;
}
#search .box {
background: url(images/search_box.gif) no-repeat;
float: left;
padding: 9px 10px;
}
#search .box input {
font: 1.0em Arial;
color: #<?php echo $text_color; ?>;
width: 152px;
border: 0px;
padding: 0px;
margin: 0px;
}
#search .go {
float: right;
margin-top: 0px;
font: 1.5em Arial;
width: 60px;
padding: 3px 0px;
}

/* Main Content */
#main {
margin-top: 15px;
padding: 0px 0px 0px 20px;
background: url(images/main_bg.gif);
}
#main #left {
line-height: 2.1em;
float: left;
width: 450px;
}
#main #left h1 {
color: #<?php echo $link_color; ?>;
font: 1.7em Georgia;
margin-bottom: 4px;
}
#main #left .one {
font-size: 0.9em;
}
#main #right {
width: 200px;
float: right;
}
#main #right h1 {
background: url(images/h1.gif) no-repeat;
font: 1.2em Arial;
padding: 11px 0px 11px 20px;
}
#main #right #list a {
background: url(images/a.gif) repeat-x bottom;
display: block;
text-decoration: none;
padding: 11px 20px;
}
#main #right #list a:hover {
text-decoration: underline;
}

#main #right #list2 {
padding: 0px 5px;
}

/* Footer */
#footer {
background: url(images/bottom.gif) no-repeat bottom;
text-align: right;
padding: 0px 20px 27px 21px;
margin-top: 2px;
}
#footer .bar {
background: #FBFBFB;
padding: 7px 14px 7px 0px;
font-size: 0.9em;
}
</style>
</head>
<body>




<div id="container">
<div id="content">










<div id="title">
<h1><div id="ttext"><a href="index.php"><?php echo $title; ?></a></div></h1>
<form name="NameForm" method="get" action="redirect.php">
<fieldset>
<div id="search">

<div class="box"><input type="text" value="<?php print($name);?>" name="name" size="20" /></div>
<input type="submit" class="go" value="Search" />
</div>
</fieldset>
</form>
</div>


<?php include("ads.php"); ?>
<div id="main">
<div id="left">




<?php

set_time_limit(0);

$file = "$feed";

$rss_channel = array();
$currently_writing = "";
$main = "";
$item_counter = 0;

function startElement($parser, $name, $attrs) {
global $rss_channel, $currently_writing, $main;
switch($name) {
case "RSS":
case "RDF:RDF":
case "ITEMS":
$currently_writing = "";
break;
case "CHANNEL":
$main = "CHANNEL";
break;
case "IMAGE":
$main = "IMAGE";
$rss_channel["IMAGE"] = array();
break;
case "ITEM":
$main = "ITEMS";
break;
default:
$currently_writing = $name;
break;
}
}

function endElement($parser, $name) {
global $rss_channel, $currently_writing, $item_counter;
$currently_writing = "";
if ($name == "ITEM") {
$item_counter++;
}
}

function characterData($parser, $data) {
global $rss_channel, $currently_writing, $main, $item_counter;
if ($currently_writing != "") {
switch($main) {
case "CHANNEL":
if (isset($rss_channel[$currently_writing])) {
$rss_channel[$currently_writing] .= $data;
} else {
$rss_channel[$currently_writing] = $data;
}
break;
case "IMAGE":
if (isset($rss_channel[$main][$currently_writing])) {
$rss_channel[$main][$currently_writing] .= $data;
} else {
$rss_channel[$main][$currently_writing] = $data;
}
break;
case "ITEMS":
if (isset($rss_channel[$main][$item_counter][$currently_writing])) {
$rss_channel[$main][$item_counter][$currently_writing] .= $data;
} else {
$rss_channel[$main][$item_counter][$currently_writing] = $data;
}
break;
}
}
}

$xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, "startElement", "endElement");
xml_set_character_data_handler($xml_parser, "characterData");
if (!($fp = fopen($file, "r"))) {
die("could not open XML input");
}

while ($data = fread($fp, 4096)) {
if (!xml_parse($xml_parser, $data, feof($fp))) {
die(sprintf("XML error: %s at line %d",
xml_error_string(xml_get_error_code($xml_parser)),
xml_get_current_line_number($xml_parser)));
}
}
xml_parser_free($xml_parser);

// output HTML


if (isset($rss_channel["ITEMS"])) {
if (count($rss_channel["ITEMS"]) > 0) {
for($i = 0;$i < count($rss_channel["ITEMS"]);$i++) {
if (isset($rss_channel["ITEMS"][$i]["LINK"])) {
print ("\n<div class=\"itemtitle\"><h1><a href=\"" . $rss_channel["ITEMS"][$i]["LINK"] . "\">" . $rss_channel["ITEMS"][$i]["TITLE"] . "</a></h1></div>");
} else {
print ("\n<div class=\"itemtitle\">" . $rss_channel["ITEMS"][$i]["TITLE"] . "</div>");
}
print ("<div class=\"itemdescription\">" . $rss_channel["ITEMS"][$i]["DESCRIPTION"] . "</div><br />"); }
} else {
print ("<b>There are no articles in this feed.</b>");
}
}
?>
<?php include("ads.php"); ?>

</div>
<div id="right">
<h1>Popular Searches</h1>
<div id="list">
<?php include("searches.php"); ?>
</div>





</div>
<p class="clear" />
</div>

</div>
<p class="clear" />
<div id="footer">
<div class="bar">
Copyright &copy; 2007 <?php echo ucfirst($title); ?> | Powered by <a href="http://www.quickminisite.com">Quick Minisite</a>
</div>
</div>
</div>
</body>
</html>


I hope this may help you understand what the problem is. One of the sites are adny.com, you can see the page source. I don't know if google blocks news feeds or Godaddy ( Linux premium PHP5 ) does something. Or maybe I need to check and edit php.ini or .htaccess files. I use multidomain in one hosting account which I think affects all my sites. Pls help! I could not find the solution anywhere. Thnx.

lorenya
10-27-2008, 11:06 PM
When I change google feed to yahoo, it works. Maybe this info may help you for helping me to find a solution. Thanks in advance.

oesxyl
10-28-2008, 10:46 AM
I hope this may help you understand what the problem is. One of the sites are adny.com, you can see the page source. I don't know if google blocks news feeds or Godaddy ( Linux premium PHP5 ) does something. Or maybe I need to check and edit php.ini or .htaccess files. I use multidomain in one hosting account which I think affects all my sites. Pls help! I could not find the solution anywhere. Thnx.

adny.com invalid markup, that could influence who the page is parsed and make hard to find what's happend.

http://validator.w3.org/check?verbose=1&uri=http&#37;3A%2F%2Fadny.com%2F

try to validate first.

regards

lorenya
10-28-2008, 07:40 PM
Thanks for the advice, I tried it. However, the news were back after 8-9 hours yesterday and today they are all gone again, around the same hours like yesterday, don't know when they will be back again. Whatever happens to adny.com is same for all my other sites. I could not solve the source of the problem. How and why this google news go suddenly and come back later. Did no one had a message like [/B]XML error: > required at line 14[B] ? I don't think it is because of something I do, but maybe google or godaddy? Any idea?

oesxyl
10-28-2008, 08:33 PM
Thanks for the advice, I tried it. However, the news were back after 8-9 hours yesterday and today they are all gone again, around the same hours like yesterday, don't know when they will be back again. Whatever happens to adny.com is same for all my other sites. I could not solve the source of the problem. How and why this google news go suddenly and come back later. Did no one had a message like [/B]XML error: > required at line 14[B] ? I don't think it is because of something I do, but maybe google or godaddy? Any idea?
look in your server logs if you have access, must be something there.

best regards

lorenya
10-29-2008, 01:51 AM
Thanks for your advice. We checked the logs but nothing seems wrong. The news feeds disappear regularly and come back again. It happened 2 times in the same hours. Now it is ok but I'm afraid tomorrow can be the same as I could not find out the problem. It gives error for 5-6 hours for all sites. Any other idea? When there is error, if I switch to yahoo feeds, it works. So is that Google who plays this wicked game?

FJbrian
11-06-2008, 01:11 AM
google limits the # of times you can "pull" news feeds from their site
Just before this error was caused, has your traffic increased?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum