Recommended Posts

I'm having trouble figuring out what it is. I tried turning on strict error reporting, and it told me one thing that was legal in the language, but not preferred. I changed this, and maybe it fixed the problem.

Try this instead:

	<?
	error_reporting(2048);
	$domdoc = new DomDocument;
	$domdoc->load('http://blog.mynimal.net/?feed=rss2');
	$xpath = new DOMXPath($domdoc);
	$titles = $xpath->query('/*/channel/item/title');
	for ($i = 0; $i < $titles->length; $i++)
	{
  echo $titles->item($i)->nodeValue;
  echo '<br>';
	}
	?>

Edited by benjeeeboy

Will this code work on PHP4? I was thinking that the 'try { } catch { }' statments was a new thing in PHP5. I might be getting some hosting in the next few weeks and wanted to use this but they only use PHP4 where I'll be getting hosting.

Cheers,

-Techy

I have absolutely no idea if it will work on PHP4. In my newer version that I am working on now, i will try to not use exceptions, so it may be compatible. I am just re-learning php now, so it may take a bit to get everything working perfectly but i will add php4 compatibility to my todo list.

I added a bunch to the test code (please post the results). Maybe this will give more insight into whats wrong so i can fix this and get and moving on the new version.

<?
	$domdoc = new DomDocument;
	$domdoc->load('http://blog.mynimal.net/?feed=rss2');
	$xpath = new DOMXPath($domdoc);
	$titles = $xpath->query('/*/channel/item/title');
	echo "Number of entries: ";
	echo $titles->length;
	echo "<br>";
	for ($i = 0; $i < $titles->length; $i++)
	{
  $itemnode = $titles->item($i);
  echo $itemnode->nodeName;
  echo ": ";
  echo $itemnode->nodeValue;
  echo '<br>';
	}
	echo "<p>";
	echo "other way:";
	echo "<br>";
	$itemlist = $domdoc->getElementsByTagName('item');
	echo "num items: ";
	echo $itemlist->length;
	echo "<br>";
	for ($j=0;$j<$itemlist->length;$j++)
	{
  $item = $itemlist->item($j);
  $itemtitles = $item->childNodes;
  for ($k=0;$k<$itemtitles->length;$k++)
  {
  	if ($itemtitles->item($k)->nodeName=='title')
  	{
    echo $itemtitles->item($k)->nodeValue;
    echo '<br>';
  	}
  }
	}
?>

Thank you for helping me help you.

Edited by benjeeeboy
I added a bunch to the test code (please post the results).  Maybe this will give more insight into whats wrong so i can fix this and get and moving on the new version.

Thank you for helping me help you.

586283921[/snapback]

Same error as before. :(

Parse error: parse error, unexpected T_OBJECT_OPERATOR in /www/g/gfxutopianet/htdocs/rss/rss-feed.php on line 30

Line 30:

  	if ($itemtitles->item($k)->nodeName=='title')

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • low latency mode is still bugged and causing bootup times slow to a crawl. To fix, you have to disable the feature with vivetool. Seems as though it's not rolled out to a lot of people yet since I've only been able to find only a handful of people that are having issues.
    • I would recommend the Nothing 2a. The battery life is awesome, 2 or 3 days without going into battery power mode. The only thing that I've been looking into recently is that it doesn't "support" Graphene OS. I'm pretty sure there is a way, I just need to do some more looking.
    • You'd have to show me an example of a listing that says Gen 1, usually i'd expect that to mean Snapdragon Gen 1 (a type of chipset, which the Pixels don't use). Pixel 7 - White - 128gb - Unlocked - 85%+ battery - Grade B+ - $159 with free delivery - https://www.ebay.com/itm/398046617206 Pixel 7 - Obsidian - 128gb - Unlocked - 80%+ battery - Very Good - $157 with free delivery - https://www.ebay.com/itm/355617734563 Both look to be sold by companies with good feedback, dealing with refurbished phones and state the phones are unlocked with a clean IMEI. Obviously I can't vouch for either company though, but the listings look good in my opinion.
    • Because Chrome is doing it. And no one said anyone had to update immediately. That's silly. They could update every day for all I care as long as it's fast, and the next time the browser restarts, you're good. And the basic point is not to tee it up for bigger updates. As it is right now, all the windows I had open reopen anyway except inprivate.
    • Why? Does anybody actually want this? The constant need to close all browser sessions and wait for a new version to install, just so that there’s a integrated coupon manager feels like a waste of everyone’s time
  • Recent Achievements

    • Week One Done
      davidbazooked earned a badge
      Week One Done
    • One Month Later
      Jamswaz earned a badge
      One Month Later
    • Week One Done
      Jamswaz earned a badge
      Week One Done
    • Rookie
      Marzoid went up a rank
      Rookie
    • Community Regular
      coch went up a rank
      Community Regular
  • Popular Contributors

    1. 1
      +primortal
      514
    2. 2
      PsYcHoKiLLa
      185
    3. 3
      +Edouard
      159
    4. 4
      Steven P.
      83
    5. 5
      ATLien_0
      75
  • Tell a friend

    Love Neowin? Tell a friend!