problem with xml usage

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • swethak
    New Member
    • May 2008
    • 118

    problem with xml usage

    hi,

    i have below mentioned code is there.In that use XML.I didn't understand this code.What purpose this code can write?what is the functionality of below code.Any body please suggest the answer....


    [php]
    <?
    require_once 'lib/inc/functions.lib.p hp';
    includeClasses( 'vehicle');

    $oVeh = new VEHICLE;

    $RetVal = 1;
    $MsgXML = '';
    $RVXML = '';
    $GETXML = '';
    $POSTXML = '';

    if(count($_REQU EST) > 0)
    {
    $Type = isset($_REQUEST['Type']) ? $_REQUEST['Type'] : '';
    $Page = isset($_REQUEST['Page']) ? $_REQUEST['Page'] : '';

    $Vehicles = $oVeh->getVehicles($P age - 1, '`vehicle_dt_ad ded` DESC', "`vehicle_t ype` = '{$Type}'");
    if($Vehicles !== FALSE && count($Vehicles ) > 0)
    {
    foreach ($Vehicles as $aVehicle)
    {
    $RVXML .= "<Vehicle>\ n";

    foreach ($aVehicle as $Key=>$Value)
    {
    $Key = str_replace(' ', '-', $Key);
    $Value = htmlentities($V alue);
    $RVXML .= "<{$Key}>{$Valu e}</{$Key}>\n";
    }

    $RVXML .= "</Vehicle>\n";
    }

    $RVXML = "<Vehicles Total=\"".count ($Vehicles)."\" >\n{$RVXML}</Vehicles>\n";
    }
    else
    {
    $RetVal = 0;
    $MsgXML = "<Message>N o RV Vehicles found!</Message>\n";
    }
    }
    else
    {
    $RetVal = -1;

    if(count($_SESS ION['ERRORS']) > 0)
    $MsgXML = "<Message>".imp lode("\n", $_SESSION['ERRORS'])."<Message>\n" ;
    else
    $MsgXML = "<Message>S ome Error Occured!<Messag e>\n";
    }




    if(count($_GET) > 0)
    {
    foreach ($_GET as $Key=>$Value)
    $GETXML .= "<{$Key}>{$Valu e}</{$Key}>\n";

    $GETXML = "<GET>\n{$GETXM L}</GET>\n";
    }

    if(count($_POST ) > 0)
    {
    foreach ($_POST as $Key=>$Value)
    $POSTXML .= "<{$Key}>{$Valu e}</{$Key}>\n";

    $POSTXML = "<POST>\n{$POST XML}</POST>\n";
    }

    header('Content-type: text/xml');
    echo "<Result Code=\"{$RetVal }\">\n".$MsgXML .$GETXML.$POSTX ML.$RVXML."</Result>";

    ?>
    [/php]
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Where did you get the code from?

    Comment

    • swethak
      New Member
      • May 2008
      • 118

      #3
      Originally posted by r035198x
      Where did you get the code from?

      My problem is when i submit the URL in text box it uses the XML parser and capture the all the images in the website. For that purpose my colleagues wrote that code.But i didn't understand that code.plz help that.

      Comment

      • Markus
        Recognized Expert Expert
        • Jun 2007
        • 6092

        #4
        Originally posted by swethak
        My problem is when i submit the URL in text box it uses the XML parser and capture the all the images in the website. For that purpose my colleagues wrote that code.But i didn't understand that code.plz help that.
        Explain what? You just told us what the code does...

        Comment

        Working...