Help with news feeds from Yahoo!
Ok,
I worked on this earlier in the summer and haven't touched it since July so the coding no longer works with Yahoo's current coding. Is there anyway I can code this so that it works even if Yahoo changes their coding format on their news pages?
Here is an example page, you will notice that it does not stop displaying the page correctly. It did however display the page correctly in July and August.
http://news.findxp.com/story.php?tmp...ance_floods_27
And here is my coding for story.php:
<php
$fp = fsockopen ("story.news.yahoo.com", 80, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br>\n";
} else {
fputs ($fp, "GET /news?tmpl=story&u=" .$_GET[u]." HTTP/1.0\r\nHost: www.yahoo.com\r\n\r\n");
while (!feof($fp)) {
$output = $output.fgets ($fp, 256);
}
fclose ($fp);
$news_begin = strpos($output, "<!-- TextStart -->");
$news_end = strpos($output, "<p>", strpos($output, "<!-- TextEnd -->"));
$news_pos = (strpos($output, "<p>", strpos($output, "<!-- TextEnd -->")) - strpos($output, "<!-- TextStart -->"));
$news = substr($output, $news_begin, $news_pos);
$news = str_replace("eeeeee", "9E0B0B", $news);
$news = str_replace("dcdcdc", "ECC630", $news);
echo $news;
}
?>
BTW, I am fairly new at PHP programming, so any sort of explaining to your solution would be greatly appreciated. Thanks. Also on a side note, I do plan on attaching to all pages where the data came from. Thanks.