hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Programming Discussion : Help with news feeds from Yahoo!
Reply

Forum Jump

Help with news feeds from Yahoo!

Reply Post New Thread In Programming Discussion Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 09-12-2002, 03:52 PM
flitcher flitcher is offline
Web Hosting Master
 
Join Date: Mar 2002
Posts: 955

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.



Sponsored Links
  #2  
Old 09-12-2002, 04:25 PM
Rich2k Rich2k is offline
Web Hosting Master
 
Join Date: May 2002
Location: UK
Posts: 2,994
I would guess that Yahoo have simply changed the format of their news stories... apart from that and the fact you are probably not supposed to resyndicate their news... but that's a different matter

  #3  
Old 09-12-2002, 04:28 PM
flitcher flitcher is offline
Web Hosting Master
 
Join Date: Mar 2002
Posts: 955
I know, I know.

__________________
Domain Software, LLC.


Sponsored Links
  #4  
Old 09-12-2002, 04:54 PM
Rich2k Rich2k is offline
Web Hosting Master
 
Join Date: May 2002
Location: UK
Posts: 2,994
My starting point would be comparing the HTML from an old news story and compare it with a new one and see what's changed

  #5  
Old 09-12-2002, 05:04 PM
flitcher flitcher is offline
Web Hosting Master
 
Join Date: Mar 2002
Posts: 955
I know, but I was wondering if there was some way I could code it so that it didn't matter if the coding on the page started? Because my current process is basically static, so I was wondering if there was a dynamic way of doing it? Thanks.

__________________
Domain Software, LLC.


  #6  
Old 09-12-2002, 06:26 PM
Rich2k Rich2k is offline
Web Hosting Master
 
Join Date: May 2002
Location: UK
Posts: 2,994
Not really. I suppose you could make guesses but without some form of structure to the data you wouldn't be able to tell the difference between the title and body. This is what XML was invented for.

Reply

Related posts from TheWhir.com
Title Type Date Posted
Yahoo Adds Encryption to Data Center Traffic and Web Properties Web Hosting News 2014-05-01 08:33:48
Yahoo Mail Usernames, Passwords Stolen in Third-Party Database Breach Web Hosting News 2014-01-31 12:27:37
Yahoo Launches Week-Long Domainapalooza to Auction More than 100 Premium Domains Web Hosting News 2013-11-18 11:05:27
Yahoo Site Visits Surpass Google for First Time Since 2011: comScore Report Web Hosting News 2013-08-22 16:01:33
Yahoo Integrates Email Client with Dropbox Cloud Storage Web Hosting News 2013-04-04 14:31:40


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?