0

I'm trying to load the contents of what should be an rss feed in a .ashx file on a client's site. I'm not sure if this is possible. Here is the code I'm using.

$doc = new DOMDocument();
$doc->load($client_url);
echo htmlentities($doc->saveXML());

All that is being echoed is <?xml version="1.0"?> which I believe is being created from the saveXML() function.

Any help?

Thanks, Caleb

Caleb Doucet
  • 1,751
  • 2
  • 14
  • 29
  • 2
    Why don't you just try? As far as URLs are concerned, there is no file-extension, just the protocol. And for trying, it's best to make error messages and warnings visible btw. – hakre Jan 24 '13 at 15:04
  • 1
    Makes sure you set the proper namespaces too. – crush Jan 24 '13 at 15:07
  • 1
    About error messages, this Q&A might be helpful: http://stackoverflow.com/a/14504459/367456 – hakre Jan 24 '13 at 15:21
  • @hakre 1. I have tried. 2. Could it be possible that the feed is created when you hit that page? I guess I need a better understanding of the load function. – Caleb Doucet Jan 25 '13 at 15:11
  • try saving the file locally first to discard problems with the network or php [`allow-url-fopen`](http://php.net/allow-url-fopen) – Carlos Campderrós Jan 25 '13 at 15:15

1 Answers1

0

I've found the problem thanks to hakre and looking at the errors. The problem was that I was using 'https' in $client_url when I should use 'http'.

Thanks for the advice in turning on my error messages. I think this will be very useful in the future as well.

Caleb Doucet
  • 1,751
  • 2
  • 14
  • 29