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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.