CSDN Forum RSS reading, (beginners learn collection, original), thank you for your advice. This is the case: The CSDN Forum does not have a mobile phone version or a tablet version. There are several other good guys who have independently designed the installation version of an addroid system, which also has its own disadvantages: be sure to install (memory occupied) and you cannot customize your favorite forum. I read the RSS on the CSDN Forum (for beginners to learn about collection and originality). thank you for your advice.
This is the case: The CSDN Forum does not have a mobile phone version or a tablet version. There are several other good guys who have independently designed the installation version of an addroid system, which also has its own disadvantages: be sure to install (memory occupied) and you cannot customize your favorite forum.
I personally like to watch things on the bus and visit the csdn Forum in bed at night. there is no way to learn. What if I directly open www.csdn.net my traffic? It takes a long time to load the wrong version, all of which are advertisements and images. Today, I wrote a program that can read csdn rss. to learn about collection and xml, I want to share it with other Chinese people. As follows:
Program Name: csdn Forum reading (for mobile phones and tablets)
Demo address: http://www.ruci.org/rss.php
Principle: php reads csdn rss and collects speeches from users on the forum.
Features: suitable for accessing forums on mobile phones, tablets, and pda mobile terminals, with no unnecessary images or advertisements. you can customize your favorite forum, with fast loading speed and low traffic, installation-free features.
Please give me some advice. what's wrong? thank you.
Rss. php
PHP code
CSDN Forum RSS readingCSDN Forum RSS reading for tablets
- Moderator recommendation-technical zone
- Moderator recommendation-living area
- Web development
- PHP
- Web development HTML (CSS)
- Web development JavaScript
- Develop MySQL/Postgresql for other databases
- Linux/Unix community
Show. php
PHP code
Csdn online browserReturn
Load ($ rss_link); // read the xml file $ rss_root = $ dom-> documentElement; // get the root of the xml data $ items = $ rss_root-> getElementsByTagName ("item"); // obtain all the item nodes foreach ($ items as $ it) {// read the first item node $ children = $ it-> childNodes; // Obtain all nodes of $ it; $ row_array = array (); // initialize the array foreach ($ children as $ key => $ e) // process each item {if (strcmp ($ e-> nodeName, "title ") = 0) // obtain 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 the string $ row. ="
"; Echo $ row ;}?>
ShowContent. php
PHP code
Untitled DocumentReturn
# IUs '; $ preg2 =' # \ (this, 111 \); \ '> (. *) <\/a> <\/dfn> <\/li> # U'; preg_match_all ($ preg, $ con, $ arr); preg_match_all ($ preg2, $ con, $ arr2); for ($ I = 0; $ I
';} Else {echo "th ". $ I. "floor ". $ arr2 [1] [$ I]. ":". $ arr [1] [$ I].'
';}}?>