Php And Xml

Discussion in 'PHP' started by robertl, Jul 21, 2007.

  1. #1
    Is there any way to use PHP in an XML script?

    Or have XML manipulate POST and/or GET (form) data?
     
    robertl, Jul 21, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    You can configure apache to parse PHP code in XML files, but it doesn't work by default. You can also use mod rewrite.

    Though, can you be a little more specific?
     
    nico_swd, Jul 21, 2007 IP
  3. robertl

    robertl Guest

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Here's the situation:

    I have a flash web video player and one of the files of the player is an xml document. inside this xml is:

    '

    I want the player to be dynamic so that according to a $_GET value i can change the string "video.flv". I tried inserting php code as such:

    But to no avail. Please help!
     
    robertl, Jul 21, 2007 IP
  4. robertl

    robertl Guest

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    to elaborate, when i try to open the php-added xml script, there is a prompt that says something like 'if you continue loading this script it may cause the computer to become unresponsive.' I continued loading and the browser became unresponsive.
     
    robertl, Jul 21, 2007 IP
  5. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #5
    Change the .xml extension to .php, and save this as .htaccess in the directory where you're using this.

    
    RewriteEngine On
    RewriteRule ^[B]your-file-name[/B]\.xml$ [B]your-file-name[/B].php?%{QUERY_STRING}
    
    Code (markup):
    Change the bold text to "playlist" or however you want to call the file.
     
    nico_swd, Jul 21, 2007 IP
  6. robertl

    robertl Guest

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    should i substitute QUERY STRING w/ something?
     
    robertl, Jul 21, 2007 IP
  7. robertl

    robertl Guest

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    ..and what exactly will that do? does it tell the server to read filename.php as filename.xml? exactly how will it solve the xml-php problem?
     
    robertl, Jul 21, 2007 IP
  8. robertl

    robertl Guest

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    just wondering, is the '/' supposed to be there after the first iteration of the boldprint file name? i recognized the caret and dollarsign as begin and end for eregi(); just making sure
     
    robertl, Jul 21, 2007 IP