There are 2 strategies to tackle this design.
1. You can store the whole raw XML strings into one of your MySQL field.
2. Break down the tags and categorize them into different field names.
Whatever your strategies are, first of all you would want to "download" the raw XML string from the RSS feed.
You can open a socket connection in your PHP script to the webserver that hosts the RSS feed. The function if I'm not mistaken is called fsockopen();
For example:
This script displays back the XML data retrieved from the server hosting the RSS feed to the client's browser.
CODE
<?php
$fp = fsockopen("rss.forum.lowyat.net", 80, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br />\n";
} else {
$out = "GET /topic/914049 HTTP/1.1\r\n";
$out .= "Host: rss.forum.lowyat.net\r\n";
$out .= "Connection: Close\r\n\r\n";
fwrite($fp, $out);
while (!feof($fp)) {
echo fgets($fp, 128);
}
fclose($fp);
}
?>
*Code snippets taken from PHP.net website. Codes value has been modified.
For the MySQL part, that should be quite straight forward. You just need to do an SQL Insert and insert the XML to your MySQL database.
After retrieving the XML string, it will stored into your PHP variable, so you can do whatever you want to it. Be it strategy #1 or strategy #2.
You would also want to schedule a cron job if you're running a Linux/*nix box or the schtasks if you are on Windows to periodically run the PHP script to update your MySQL database with the latest RSS feed.
Thanks
This post has been edited by geekster129: Jan 24 2009, 01:47 PM