MSV FM

dot.antimicrobial@66.96.161.157: ~ $
Path : /hermes/sb_web/sb_web/b1705/libeyne.com.mv/
File Upload :
Current < : //hermes/sb_web/sb_web/b1705/libeyne.com.mv/weather2.php

    <?php
    //I am using the DOM(Document Object Model) library to read the entire XML document into memory first.
    $doc = new DOMDocument();
    $doc->load('http://weather.yahooapis.com/forecastrss?p=MVXX0001&u=c');
    //now I get all elements inside this document with the following name "channel", this is the 'root'
    $channel = $doc->getElementsByTagName("channel");
    //now I go through each item withing $channel
    foreach($channel as $chnl)
    {
    //I then find the 'item' element inside that loop
    $item = $chnl->getElementsByTagName("item");
    foreach($item as $itemgotten)
    {
    //now I search within '$item' for the element "description"
    $describe = $itemgotten->getElementsByTagName("description");
    //once I find it I create a variable named "$description" and assign the value of the Element to it
    $description = $describe->item(0)->nodeValue;
    //and display it on-screen
    echo $description;
    }
    }
    ?>