Jump to content

RSS feed


runeveryday

Recommended Posts

$feed=file_get_contents('URL');

$rss=new  SimpleXmlElement($feed);

foreach($rss->channel->item as $entry)

{echo "<p><a href='$entry->link' title='$entry->title'>" . $entry->title . "</a></p>";} 

who can tell me what the $rss->channel->item mean.

in php,i found state a class's format is

 

class classname{...;}

when refer the content of the class,the format is

$variablename=new classname, $variablename->the content of the class,however,in the above example,i found there is now state channel in SimpleXmlElement($feed);why?

i am a beginner of php and expect some can explain these details.

 

thank you!

Link to comment
Share on other sites

$feed=file_get_contents('URL');

$rss=new  SimpleXmlElement($feed);

foreach($rss->channel->item as $entry)

{echo "<p><a href='$entry->link' title='$entry->title'>" . $entry->title . "</a></p>";} 

who can tell me what the $rss->channel->item mean.

in php,i found state a class's format is

 

class classname{...;}

when refer the content of the class,the format is

$variablename=new classname, $variablename->the content of the class,however,in the above example,i found there is now state channel in SimpleXmlElement($feed);why?

i am a beginner of php and expect some can explain these details.

 

thank you!

 

$rss is an object. channel could be a function of the object. item could be a variable of the object. Fairly simple if you understand OOP.

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.