Question from new users: this is a strange question. Basic RSS applications

Source: Internet
Author: User
Question: This is a strange question .. PHPcode & lt ;? Phprequire_once (magpierssrss_fetch.inc); $ url & quot; localhostPHPProjectRSSRSS. xml & quot; $ rssfetch_r: this is a strange question .. Basic RSS applications
PHP code
  
  channel['title'];    echo '

Latest News from ' . $feedTitle . '

'; foreach ($rss->item as $it) { $link = $it['link']; $title = $it['title']; $description = isset($it['description']) ? $it['description'] : ''; echo '

' . $title . '
' . $description . '

'; }?>


XML:
(Http: // localhost/PHPProject/RSS. xml)
XML code
    
   - 
  
   - 
     
    XHTML   
    http://localhost/PHPProject/NewFile.html   
    
     Free web building tutorials
       
    
     Web development
       
    
     en-US
       
    
     2006 w3school.com.cn. All rights reserved.
     - 
      
     RSS Tutorial   
     http://localhost/PHPProject/NewFile.html   
     
      New RSS tutorial on W3School
        service@w3school.com.cn   
     
      http://localhost/PHPProject/NewFile.html
        
      
     
  


1.
Why is it displayed as follows:
Latest News from W3School Home Page

RSS Tutorial
New RSS tutorial on W3School

After clicking RSS Tutorial, HTTP 403 is displayed?




2.
In the foreach ($ rss-> item as $ it) of PHP, why do you have to set items to run successfully? otherwise
Latest News from W3School Home Page


Notice: Undefined property: MagpieRSS ::$ item in D: \ Apache Group \ Apache2 \ htdocs \ PHPProject \ index5.php on line 10

Warning: Invalid argument supplied for foreach () in D: \ Apache Group \ Apache2 \ htdocs \ PHPProject \ index5.php on line 10


But in my XML Inside is Rather Oh ....




3.
Before I modify the XML file In It is "W3School Home Page", so it is displayed as Latest News from W3School Home Page at runtime. However, after modification, it is shown as above <title> XHTMLWhy is Latest News from W3School Home Page displayed after refresh?

Even if you restart zend studio, Latest News from W3School Home Page is displayed .... It's not about caching .. I have cleared the cache.


Please help .. I have sharded

------ Solution --------------------
1. your code has a problem:
Echo'

'. $ Title .'
'. $ Description .'

';
Because $ link is enclosed in single quotes, it will not be parsed. So the link is the link on this page $ link
As for why 403 has no permission, it depends on your server settings.

2. RSS standards: A channel may contain any number S.
XML code
      
       
...
       
        
...
            
       
        
...
            
       
      
------ Solution --------------------
Discussion

Reference:

How did you modify it. As follows:
Echo"

$ Title
$ Description

";


Isn't that okay ??

Echo'

'. $ Title .'
'. $ Description .'

';

Not to say ......

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.