Jump to content

php reading in xml file error


MidOhioIT

Recommended Posts

when using the following code:

$xml3 = simplexml_load_file('image_and_link_featured.xml');
$images3 = array();
foreach($xml3->pic as $link)
{ $links3[] = $link->link; }

$Featurelink1 = $links3[0];

 

I get the errors:

image_and_link_featured.xml:5: parser error : EntityRef: expecting ';' in /index_with_links.php on line 29

 

Warning: simplexml_load_file() [function.simplexml-load-file]: <link>show_coupon.php?catparam=5&business in /index_with_links.php on line 29

 

Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in /index_with_links.php on line 29

 

Warning: Invalid argument supplied for foreach() in /index_with_links.php on line 31

 

 

Here are lines 29 - 31:

$xml3 = simplexml_load_file('image_and_link_featured.xml');
$images3 = array();
foreach($xml3->pic as $link)

 

Here is the xml file content that can not change:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<images>
    <pic>
        <image>featuredsponsor1.jpg</image>
        <link>show_coupon.php?catparam=5&business=MATTRESS+ONE+FURNITURE+COMPANY</link>
    </pic>
</images>

 

Does anone have any ideas? It is obvious to me is is not liking the link because of what is in it but I am ok with it just reading it as a text string

Link to comment
https://forums.phpfreaks.com/topic/201325-php-reading-in-xml-file-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.