title: Updating a xml file with php simplexml tool
body: <p>I have a very simple xml content <code>videolar.xml</code>.  Flash player takes these elements and plays them. I want to change the <code>&lt;title&gt;</code> and <code>&lt;youtube&gt;</code> elements by <code>php simplexml</code>. I wrote a code <code>video.php</code> to change these elements. When I run <code>video.php</code> it prints like below. It looks like it works, but if I play the player it plays led zeppelin still, and does not play whitesnake. If I open <code>video.xml</code> by browser I see that xml file has not changed. Still led zeppelin. So how can I update flashplayer's playlist?</p>
  
  <p>videolar.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
    &lt;playlist&gt;
      &lt;track&gt;
        &lt;title&gt;led zeppelin - kashmir&lt;/title&gt;
        &lt;youtube&gt;sfR_HWMzgyc&lt;/youtube&gt;
      &lt;/track&gt;
      &lt;track&gt;
        &lt;title&gt;pink floyd - eclipse&lt;/title&gt;
        &lt;youtube&gt;BUwUKyztI10&lt;/youtube&gt;
      &lt;/track&gt;
    &lt;/playlist&gt;
  </code></pre>
  
  <p>video.php</p>
  
  <pre><code>&lt;?php
    $completeurl = $_SERVER['DOCUMENT_ROOT'].'/ytplayer/videolar.xml';
    $xml = simplexml_load_file($completeurl);
  
    $xml-&gt;track[0]-&gt;title = 'Whitesnake - Is this love';
    $xml-&gt;track[0]-&gt;youtube = 'GOJk0HW_hJw';
  
    print_r($xml);
  ?&gt;
  </code></pre>
  
  <p>When I run this code above it prints:</p>
  
  <pre><code>(
    [track] =&gt; Array
    (
      [0] =&gt; SimpleXMLElement Object
      (
        [title] =&gt; Whitesnake - Is this love
        [youtube] =&gt; GOJk0HW_hJw
      )
      [1] =&gt; SimpleXMLElement Object
      (
        [title] =&gt; pink floyd - eclipse
        [youtube] =&gt; BUwUKyztI10
      )
    )  
  )
  </code></pre>