• Notice regarding image hosts and attachments. See here.

PHP Question

Soldato
Joined
11 Jun 2005
Posts
3,604
Location
Liverpool
Hi Guys,

I'm using wamp on my local machine for testing with, I've found a basic tutorial I'm following and the code works fine on the webspace I've got but it doesn't fucntion correnctly using wamp so I think the problem is with the setup for wamp on my machine.

The tutorial is here - http://www.w3schools.com/php/php_ajax_rss_reader.asp, it's the php page getrss.php which has the problem.

The bit of the code that seems to have the problem is this:

PHP:
<?php
 
$xml=("http://news.google.com/news?ned=us&topic=h&output=rss");

$xmlDoc = new DOMDocument();

$xmlDoc->load($xml);

//get elements from "<channel>"
$channel=$xmlDoc->getElementsByTagName('channel')->item(0);
;

It gets to the line
PHP:
$xmlDoc->load($xml);
and then seems to output all the code following the ->

On my website though, the code seems to work fine - http://whoracle.com/rsstest/getrss.php

When running the file through wamp I get the output:
PHP:
load($xml); //get elements from "" $channel=$xmlDoc->getElementsByTagName('channel')->item(0);
(it goes on to display the rest of the code)

I'm expecting there may be a setting that is different or an extension mising or not enabled but I don't know where to begin looking. Any help would be appreciated :)
 
An update - I posted on another forum and found the problem. The PHP wasn't parsing for some reason, viewing the source shown all the text before the > was treated as html hence not appearing. Restarting seems to have fixed it all.
A silly problem, but I figured I'd post it the unlikely event that someone finds this in the future with the same problem.
 
Back
Top Bottom