CSDN Forum RSS Reading, (Novice learning Collection, original), thank you for your advice.

Source: Internet
Author: User
Tags preg
The situation is this: CSDN forum, there is no mobile version, there is no tablet computer version; Other heroes have designed a addroid system to install the installation version, but also has its downside: be sure to install (occupy the space of memory) and can not customize their favorite section.

I personally like to see things on the bus, in the evening also like to visit the CSDN forum in bed, in order to learn there is no way. What if I open the www.csdn.net directly to my traffic? Loading time is very long and the wrong version, all ads, pictures. Today, I wrote a program that can read CSDN RSS, to learn to collect and XML, share with the heroes. As follows

Program Name: CSDN Forum Reading (mobile, Tablet PC only)

Demo Address: http://www.ruci.org/rss.php

Principle: Php reads csdn RSS, and then collects the speeches of the users in the forum.

Features: Suitable for mobile phones, tablets, PDA mobile terminal access to the forum, no extra pictures, no ads, can customize their favorite section, loading speed, less flow, free installation features.
Please expert guidance, inappropriate, thank you.
rss.php
 
  CSDN Forum RSS Reading

CSDN Forum RSS Reading, Tablet PC-specific

  • Moderator Recommendation-Technical area
  • Moderator recommendation-Living area

  • Web Development
  • Php
  • Web Development HTML (CSS)
  • Web Development JavaScript
  • Other database development Mysql/postgresql

  • Linux/unix Community

show.php
 
  CSDN Online Browser

Return

Load ($rss _link);//Read the XML file $rss_root= $dom->documentelement;//get the root $items= of the XML data $rss _root-> getElementsByTagName ("item");//Get all the Item node foreach ($items as $it) {//Read the first item node $children= $it->childnodes;//Get $ all nodes of it; $row _array=array ();//Initialize array foreach ($children as $key + $e)//Process each item{if ((strcmp ($e->nodename, "title ==0))//Gets the title and link{of each item $row _array[$e->nodename]= "*". $e->nodevalue;} if ((strcmp ($e->nodename, "link") ==0) {$row _array[$e->nodename]= "NodeValue." >read ";}} $row =implode ("= =", $row _array);//Save the Read data to a string $row.= "
"Echo $row;}?" >

showcontent.php
 
  Untitled Document

Return

#iUs '; $preg 2= ' #\ (this,111\); > (. *) <\/a><\/dfn><\/li> #U ';p reg_match_all ($preg, $con, $arr); Preg_match_all ($preg 2, $con, $arr 2); for ($i =0; $i
';} Else{echo "No." $i. " Building ". $arr 2[1][$i].": ". $arr [1][$i]. '
';}}? >


Reply to discussion (solution)

Support original sharing, with SimpleXML code estimates can be less, XML processing I do not much, most of the time is the use of JSON
I'll knot this.

Bull man!

Generally subscribe to the kind of RSS, there are new messages, will be pushed to the client, this is the RSS

The address was not handled well.

That's a bull man.

Presentation Address not open

Dom operation .... I thought only JS can do DOM operation, shame AH.

Good and helpful.

  • Related Article

    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.