PHP XML Reader Coding

timer Asked: Feb 5th, 2014

Question description

What is the alternative way to read an XML file from PHP, below is my coding and what i am required to do:

I'm trying to read information from an XML file using php. When i run the code bellow on my local machine i can view all the information, but when i upload the web pages and xml file to the server the web page freezes and does not display the information.
<?xml version="1.0" encoding="UTF-8"?>




<entryname="Message"type="string">Don't forget me this weekend!</entry></entry>

    $xmlPath ='default.xml';
    $objDOM =newDOMDocument('1.0','utf-8');
    $objDOM->load($xmlPath);//make sure path is correct 
    $label = $objDOM->getElementsByTagName("entry");foreach($label as $val){if($val->getAttribute('type')==='string'){
            echo  $val->nodeValue;}



I need to get below output:

Don't forget me this weekend!

Tutor Answer

(Top Tutor) Studypool Tutor
School: UCLA
Studypool has helped 1,244,100 students
flag Report DMCA
Similar Questions
Hot Questions
Related Tags

Brown University

1271 Tutors

California Institute of Technology

2131 Tutors

Carnegie Mellon University

982 Tutors

Columbia University

1256 Tutors

Dartmouth University

2113 Tutors

Emory University

2279 Tutors

Harvard University

599 Tutors

Massachusetts Institute of Technology

2319 Tutors

New York University

1645 Tutors

Notre Dam University

1911 Tutors

Oklahoma University

2122 Tutors

Pennsylvania State University

932 Tutors

Princeton University

1211 Tutors

Stanford University

983 Tutors

University of California

1282 Tutors

Oxford University

123 Tutors

Yale University

2325 Tutors