weird problem..the exact xml work in one host and not working in another
i search alot for this but can't find an aswer... I have made a working xml parser using php. till today i host my files on a free web host, and everything works just fine. today i got access to my college server and i host my files there.
now for some reason.. i can't make the parser work as i was in the free host...
look on those files please: working site:
xml file: [http://ofear.onlinewebshop.net/asce/calendar.xml]
working parser is this: [http://ofea开发者_开发问答r.onlinewebshop.net/asce/calendar.php]
(the lower table is the xml,it's hebrew)
not working site:
xml file: [http://apps.sce.ac.il/agoda/calendar.xml]
not working parser is this: [http://apps.sce.ac.il/agoda/calendar.php]
anyone have idea why it's not working.. those are the same files and they should work.
maybe it a server problem?
calendar.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<events>
<record>
<event>ערב פתוח לקורס מורי דרך</event>
<eventDate>30/12/2010</eventDate>
<desc>בשלוחת תל אביב</desc>
</record>
<record>
<event>כנס חיפה לתיירות - 2 : נכנס יין יצאה תיירות</event>
<eventDate>22/12/2010</eventDate>
<desc>המרכז לחקר התיירות בשיתוף בית הספר לתיירות בישראל שמחים להודיע על כנס חיפה לתיירות 2 שיתקיים בחיפה בתאריכים 22-23 בדצמבר 2010. השנה יוקדש הכנס לנושא "תיירות היין"</desc>
</record>
<record>
<event>פתיחת קורס מפעילי תיירות - תל אביב</event>
<eventDate>5/12/2010</eventDate>
<desc>ימי ראשון 17:30-20:45</desc>
</record>
</events>
parser:
<?php
$doc = new DOMDocument();
$doc->load( 'calendar.xml' );
$events = $doc->getElementsByTagName( "record" );
foreach( $events as $record )
{
$events = $record->getElementsByTagName( "event" );
$event = $events->item(0)->nodeValue;
$eventDates= $record->getElementsByTagName( "eventDate" );
$eventDate= $eventDates->item(0)->nodeValue;
$descs = $record->getElementsByTagName( "desc" );
$desc = $descs->item(0)->nodeValue;
echo "<tr><td>$event</td><td>$eventDate</td><td>$desc</td></tr>";
}
?>
after a little debugging i saw that it's stop here: $doc = new DOMDocument(); and it's not doing anything after that. i think that the line above is the cos
Be sure that you are checking the version of php being run on the server, if it's PHP 4 then you must use DOM XML.
And if it's PHP 5 be sure to check if the DOM Extension is installed.
OK.This is the answer. it's seems that the DOM function is not working on this server. so i can't use this script. I used this:
<?php
if (function_exists('domxml_new_doc')) {
echo "DOM XML functions are available.<br />\n";
} else {
echo "DOM XML functions are not available.<br />\n";
}
?>
and it's says that "DOM XML functions are not available" so i need to see what can i do..
精彩评论