1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Trying to create an Atom feed in php

Discussion in 'PHP' started by piniyini, Jul 19, 2005.

  1. #1
    and I ran into a little problem ...

    because its in a php file I've added the following at the start

    <?php @header("Content-Type:text/xml"); ?>
    PHP:
    and after this I have got
    SEMrush
    [SIZE=2]<?xml version="1.0" encoding="iso-8859-1" ?>[/SIZE]
    Code (markup):
    I'm getting an error for the above code because it thinks its php

    Parse error: parse error, unexpected T_STRING online 2

    how to solve this?
     
    piniyini, Jul 19, 2005 IP
    SEMrush
  2. kalius

    kalius Peon

    Messages:
    599
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    0
    #2

    Try:
    [SIZE=2]echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?>";[/SIZE]
    Code (markup):

    P.S. I'm not a php expert
     
    kalius, Jul 19, 2005 IP
  3. piniyini

    piniyini Well-Known Member

    Messages:
    511
    Likes Received:
    26
    Best Answers:
    0
    Trophy Points:
    170
    #3
    Ta Kalius, I figured it out myself a bit later on just forgot to mention it here. Thanks nontheless. I'm coding a football site and little things keep poppin up
     
    piniyini, Jul 19, 2005 IP
  4. bingbong

    bingbong Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I have the same problem! can you tell me how did you solve this please? by add this echo "<>" thing? thanks
     
    bingbong, Nov 7, 2006 IP
  5. TwistMyArm

    TwistMyArm Peon

    Messages:
    931
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #5
    The problem is that short tags is probably enabled and so it's seeing that <? on the XML line and thinking "yep, that's PHP!". Obviously, it isn't.

    If it were me, I'd just use the FeedCreator library from http://www.bitfolge.de/rsscreator-en.html and forget about trying to re-implement the wheel.
     
    TwistMyArm, Nov 7, 2006 IP