My company has some old PHP code that has been running on PHP 5.2 for quite sometime but our web host is getting rid of PHP 5.2. The script is using domxml-php4-to-php5.php to run the domxml. For some reason when I change over to PHP 5.3 the script will not pull in the XML file. It just returns "You didn't choose a file to edit!". I just need to get this working on PHP 5.3 for the time being while I update the code for PHP 5.
<?php
session_start();
if (PHP_VERSION>='5')
require_once('domxml-php4-to-php5.php');
function extractText($array){
if(count($array) <= 1){
//we only have one tag to process!
for ($i = 0; $i<count($array); $i++){
$node = $array[$i];
$value = $node->get_content();
}
return $value;
}
}
//pull in the XML file
if ($file == ""){
echo "<h2>You didn't choose a file to edit!</h2>";
echo "<a href=\"ndpnews.php\">Go back to index and choose a file</a>";
exit;
} else {
$open = "./xml/" . $file;
$xml = domxml_open_file($open);
$root = $xml->root();
$id = $root->get_attribute("id");
$h_array = $root->get_elements_by_tagname("headline");
$headline = extractText($h_array);
$stat_array = $root->get_elements_by_tagname("status");
$status = extractText($stat_array);
$a_array = $root->get_elements_by_tagname("author");
$author = extractText($a_array);
$e_array = $root->get_elements_by_tagname("email");
$email = extractText($e_array);
$ab_array = $root->get_elements_by_tagname("abstract");
$abstract = extractText($ab_array);
$kl_array = $root->get_elements_by_tagname("keywords");
$keywords = extractText($kl_array);
$img_array = $root->get_elements_by_tagname("image");
$image = extractText($img_array);
$lead_array = $root->get_elements_by_tagname("para-intro");
$para["intro"] = extractText($lead_array);
$second_array = $root->get_elements_by_tagname("para-main");
$para["main"] = extractText($second_array);
$con_array = $root->get_elements_by_tagname("para-conclusion");
$para["con"] = extractText($con_array);
$logo_array = $root->get_elements_by_tagname("logo");
$logo = extractText($logo_array);
$dt_array = $root->get_elements_by_tagname("dateandtime");
$dateandtime = extractText($dt_array);
$wh_array = $root->get_elements_by_tagname("where");
$where = extractText($wh_array);
$ph_array = $root->get_elements_by_tagname("phone");
$phone = extractText($ph_array);
$web_array = $root->get_elements_by_tagname("website");
$website = extractText($web_array);
$map_array = $root->get_elements_by_tagname("map");
$map = extractText($map_array);
$pagetitle_array = $root->get_elements_by_tagname("pagetitle");
$pagetitle = extractText($pagetitle_array);
?>