|
|
Born October 26th, 1969 (Yes, that makes me 40 -- my birthday is in 88 days) |
| Scorpio Horoscope for July 30, 2010 |
You can't figure out where this is all leading, but you're pretty sure you're liking it. The one thing you don't know for sure is whether or not you're going to be comfortable when you land. Invite someone else (maybe new) along for the ride, so no matter where you find yourself, at least you're both happy. Gather your courage and ask. There are many more important qualities than comfort -- and when have you ever been shy?
|
[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); ?>
|
|