XML on PHP

General discussions related to php

Moderators: macek, egami, gesf

Obiwans
New php-forum User
New php-forum User
Posts: 3
Joined: Thu Mar 14, 2013 1:42 am

XML on PHP

Postby Obiwans » Thu Mar 14, 2013 2:28 am

Hi guys . My name is Ricado Baptista i am new here and i have a problem, I got this code:


<html>
<head>
</head>
<body >
<?php
header('Content-type: text/xml');
$xml = simplexml_load_file("saft_solverde_wgres_FAC2-01-2013-500272484.xml");
foreach($xml->Invoice as $Invoice)
{
echo $InvoiceNo->InvoiceNo;
}
?>
</body>
</html>

But when i run it i go this:

"This XML file does not appear to have any style information associated with it. The document tree is shown below.
<html>
<head></head>
<body></body>
</html>"

Why nothing is appearing? where is my error?
Sorry if this is not the right place for this topic.

johnj
php-forum Super User
php-forum Super User
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm

Re: XML on PHP

Postby johnj » Thu Mar 14, 2013 4:44 am

1).What browser are you using?

2).Please print more details of the error. You may want to use the error function in php.

Obiwans
New php-forum User
New php-forum User
Posts: 3
Joined: Thu Mar 14, 2013 1:42 am

Re: XML on PHP

Postby Obiwans » Thu Mar 14, 2013 4:57 am

I am using google chrome i am trying open a xml by using php
the xml version is windows-1252

johnj
php-forum Super User
php-forum Super User
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm

Re: XML on PHP

Postby johnj » Thu Mar 14, 2013 5:15 am

Are you sure your chrome has the necessary rss/xml extensions installed?
Also, are you running any other products (like a password manager, firewall etc etc) when you access this xml?

Obiwans
New php-forum User
New php-forum User
Posts: 3
Joined: Thu Mar 14, 2013 1:42 am

Re: XML on PHP

Postby Obiwans » Thu Mar 14, 2013 5:58 am

all rss instaled .
No i dont use password's or firewall to access the xml.

johnj
php-forum Super User
php-forum Super User
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm

Re: XML on PHP

Postby johnj » Thu Mar 14, 2013 7:52 pm

As I said before, please get more details of the error. Use try catch block or the error functions in php


Return to “PHP General”

Who is online

Users browsing this forum: No registered users and 2 guests

cron