Load php file wth xml header
Posted
by
John Smith
on Stack Overflow
See other posts from Stack Overflow
or by John Smith
Published on 2012-11-15T22:49:51Z
Indexed on
2012/11/15
23:00 UTC
Read the original article
Hit count: 154
I have a php file with an xml header and xml code, named test.php.
How do I load this file as an xml?
The following doesn't work:
$xml = simplexml_load_file('test.php');
echo $xml;
I just get a white page.
The test file is saved as php, as it's dynamic. It's loading data from the tradedoubler api. The xml looks something like this:
<voucherList>
<voucher>
<id>115</id>
<programId>111</programId>
<programName>Program 111</programName>
<code>AF30C5</code>
<updateDate>1332422674941</updateDate>
<startDate>1332370800000</startDate>
<endDate>1363906800000</endDate>
<title>Voucher number one</title>
<shortDescription>Short description of the voucher.</shortDescription>
<description>This is a long version of the voucher description.</description>
<voucherTypeId>1</voucherTypeId>
<defaultTrackUri>http://clk.tradedoubler.com/click?a(222)p(111)ttid(13)</defaultTrackUri>
<siteSpecific>True</siteSpecific>
</voucher>
<voucher>
<id>116</id>
<programId>111</programId>
<programName>Program 111</programName>
<code>F90Z4F</code>
<updateDate>1332423212631</updateDate>
<startDate>1332370800000</startDate>
<endDate>1363906800000</endDate>
<title>The second voucher</title>
<shortDescription>Short description of the voucher.</shortDescription>
<description>This is a long version of the voucher description.</description>
<voucherTypeId>1</voucherTypeId>
<defaultTrackUri>http://clk.tradedoubler.com/click?a(222)p(111)ttid(13)url(http://www.example.com/product?id=123)</defaultTrackUri>
<siteSpecific>False</siteSpecific>
<landingUrl>http://www.example.com/product?id=123</landingUrl>
</voucher>
</voucherList>
© Stack Overflow or respective owner