I am trying to create an RSS feed for my school's newspaper via the PHP5 DOM support. I main page from their website around 1am via curl and then run HTML tidy on it to clean it up.
Once clean, I use PHP to extract the href attribute as the <link> tag for the RSS feed. The problem I am having is setting a title. Unfortunately, no one on my school's paper knows what a "title" attribute is, so I can't use the same method I used for getting the URL.
how can i go about getting the value between the <a></a> tags? here is the relevant code I have so far.
<?php
foreach ($params as $param) {
if (!substr_compare($param -> getAttribute('href'), $strValue, 0, $strLength, true)) {
echo "<item>\n";
echo "\t\t\t<title>" . "no clue how to do this" . "</title>\n";
echo "\t\t\t<link><![CDATA[http://www.purdueexponent.com" . trim($param -> getAttribute('href')) . "]]></link>\n";
echo "</item>\n";
}
}
?>
Once clean, I use PHP to extract the href attribute as the <link> tag for the RSS feed. The problem I am having is setting a title. Unfortunately, no one on my school's paper knows what a "title" attribute is, so I can't use the same method I used for getting the URL.
how can i go about getting the value between the <a></a> tags? here is the relevant code I have so far.
<?php
foreach ($params as $param) {
if (!substr_compare($param -> getAttribute('href'), $strValue, 0, $strLength, true)) {
echo "<item>\n";
echo "\t\t\t<title>" . "no clue how to do this" . "</title>\n";
echo "\t\t\t<link><![CDATA[http://www.purdueexponent.com" . trim($param -> getAttribute('href')) . "]]></link>\n";
echo "</item>\n";
}
}
?>