Jump to content

Question...


mikey.rr

Recommended Posts

Well, I was thinking about making a news script. Sort of like a CMS, but it will just see data from an RSS feed, go to the link, and rip the news text and title off the page and display it.

 

I don't know if this is even possible.

My example:

Use MagPieRSS to display CNN's Top Stories RSS (link)

If there's an update to the RSS, *somehow* it will get data from the CNN News page (news text, and the title) and display it in a page like "cnn.php?article_id=1".

 

Is this even possible? Or do you have a suggestion about a better way to do this?

 

If I'm not clear, just say so and I'll try to clarify.

 

Oh and by the way, I'd consider myself an intermediate-advanced coder.

 

Link to comment
Share on other sites

I HATE xml parsing.  If you want the easy way I suggest searching up (xml to array) class or (xml to html) class.

These are going to be your most likely, and easiest, path to take.  Or you can parse them from scratch using expat, simple xml, or xml dom (all can be found in rich examples and explanations at www.w3schools.com under the php tutorials.

Link to comment
Share on other sites

Fatal error: Call to undefined function: stream_get_contents() in public_html/mikey/news/cnn2.php on line 3

 

??

 

This is my code:

<?php
$h = fopen("http://www.cnn.com","r");
$c = stream_get_contents($h);
fclose($h);
//...
//Run some RegEx on $c to pull out the bits you want...
//...
echo $c;
?>

Link to comment
Share on other sites

That is then because they are restricting access to it.

Try adding a php.ini file in the root directory and set allow urlfopen to on.

Then see if it works, if it's ignoring it then it doesn't.

Then try htaccess and try setting a flag for url fopen (if there's a flag to it).

If that doesn't work contact your host and check your options.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.