I am running on php 4.4.1 on a Linux system. domxml is enabled along with XPath support.
Apparently the code should work with php 4 and has worked for other users of the news feed. The guys providing the code seem to think it may be a problem with the version of the DOM/XML API Version which my hosts are using version: 20020815
I get the following error message when trying to run the code:
Warning: xpath_eval(): Invalid expression in /path of file on line 29
Warning: xpath_eval(): xmlXPathEval: evaluation failed in /path of file on line 29
Article found: 0
Any help much appreciated.
Code is as follows:
Code: Select all
$dataFile = fopen ('http://newssiteurl.co.uk/?c21c0905-b9ca-43ee-87be-7e4308406da6','r')
or die("Error Loading XMl");
if ( $dataFile )
{
while (!feof($dataFile))
{
$buffer .= fgets($dataFile, 4096);
}
fclose($dataFile);
}
else
{
die( "fopen failed for $filename" ) ;
}
// Loading xml into a DOM object.
$dom = domxml_open_mem($buffer);
$xpc = xpath_new_context($dom);
// Selecting nodes matching node "Article" using xpath_eval command and passing it the xpath context
$nodes = xpath_eval($xpc, "//Article/");