www.webdeveloper.com
Results 1 to 3 of 3

Thread: php xml - update data

  1. #1
    Join Date
    May 2012
    Posts
    11

    php xml - update data

    Hi, i have php xml parser. I have create a ticker with the data from xml and works gr8. What i need now is how can i update the data (xml is from external url and updatable)

    the the code that i use is

    PHP Code:
    <?php

    $html 
    "";
    $url"http://www.somesite.com/ticker/ticker.xml";
    $xml simplexml_load_file($url);

    $xml simplexml_load_file($url);


    ?>

    <div align="center">

    <marquee scrollamount="4" height="30" width="920" style="background-image : URL(/stockmarketticker_back.png) ;
    background-attachment : fixed ;color : #663333 ;padding-top :3"> 
    <strong>
    <?php
    foreach($xml->as $stock)
      {
        
    $StockSymbol $stock->attributes()->s.' :  ';  
        
    $StockPrice $stock->attributes()->l.' ◎ ';
        
    $StockMetavli $stock->attributes()->c.' ◎ ';
        
    $StockMetavli1 $stock->attributes()->p.'%◎ ';

        
        
    $color "white";

    if (
    $StockMetavli1 0$color '#E80000 ';
    elseif (
    $StockMetavli1 0$color '#33FF66';


    echo 
    "<font color=white font face='arial' size='3pt'>$StockSymbol</font>";
    echo 
    "<font color=$color font face='arial' size='3pt'>$StockPrice</font>";

    echo 
    "<font color=$color font face='arial' size='3pt'>$StockMetavli</font>";
    echo 
    "<font color=$color font face='arial' size='3pt'>$StockMetavli1</font>";

    }
    ?>
    </strong>
    </marquee>
    </div>
    i want to update data from xml without refreshing the page...

    thanks
    Last edited by Chrisad; 05-23-2012 at 01:30 PM.

  2. #2
    Join Date
    Aug 2006
    Posts
    1,897
    Quote Originally Posted by Chrisad View Post
    i want to update data from xml without refreshing the page...

    thanks
    Presumably you're talking about updating the user's browser window, not updating the XML file, correct? If so, this is a Javascript question, of updating via the HTML DOM, not a PHP or XML question.

    You might want to ask in the JS forum.

    Dave

  3. #3
    Join Date
    May 2012
    Posts
    11
    basicaly the ticker -read- the xml and show the data. the xml is updated (the values are stock prices) and i whan't the users view the updated data as much time stay at the page, without refresh or reload the page.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles