|
|
Born October 26th, 1969 (Yes, that makes me 38) |
| Scorpio Horoscope for July 23, 2008 |
When it comes to helping other people, quality is much more important than quantity. After all, you should be doing it because you want to, not to score brownie points, right? So if you've got a friend who needs advice on their love life, an extra hand to help them move, or another pair of eyes to help them proofread their resume, don't do it halfway. Don't be watching the clock, worrying about how much time you're spending with them. Give them more time than you think they'll need.
|
[Toggle PHP Source]
<?php //http://us2.php.net/manual/en/ref.dom.php
$doc = new DOMDocument();
$doc->preserveWhiteSpace = false; //$doc->preserveWhiteSpace = true; //$doc->load('./horoscope.xml'); $doc->load('http://feeds.astrology.com/dailyextended');
//$doc->formatOutput = true; //echo $doc->saveXML();
$xpath = new DOMXPath($doc);
//there's got to be a better way to jump to the "Scorpio" node than this... $starSign = $xpath->query('//rss/channel/item/title');
//try this in "xmllint --shell horoscope.xml" // "xpath //title[contains(text(),"Scorpio")]/text()"
foreach ($starSign as $sign) { if (strpos($sign->nodeValue, 'Scorpio') !== false) { //echo "Found Scorpio Node!<br>\n"; //echo "nodeValue: ".$sign->nodeValue."<br>\n"; foreach ($sign->parentNode->childNodes as $item) { //echo "item <b>nodeName</b> = ".$item->nodeName." and <b>nodeValue</b> = ".$item->nodeValue ."<br>\n"; $horoscope[$item->nodeName] = trim($item->nodeValue); } break; //breaks out of the foreach() } //echo "Checking node: ".$sign->nodeValue."<br>\n"; }
//scrub out hyperlinks and crap we don't want $horoscope['description'] = preg_replace("/More horoscopes.*/s", '', $horoscope['description']);
//print_r($horoscope); ?>
|
|