Connecting Tech Pros Worldwide Forums | Help | Site Map

problem with xml usage

Member
 
Join Date: May 2008
Posts: 118
#1: Jul 8 '08
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.php';
includeClasses('vehicle');

$oVeh = new VEHICLE;

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

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

$Vehicles = $oVeh->getVehicles($Page - 1, '`vehicle_dt_added` DESC', "`vehicle_type` = '{$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($Value);
$RVXML .= "<{$Key}>{$Value}</{$Key}>\n";
}

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

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

if(count($_SESSION['ERRORS']) > 0)
$MsgXML = "<Message>".implode("\n", $_SESSION['ERRORS'])."<Message>\n";
else
$MsgXML = "<Message>Some Error Occured!<Message>\n";
}




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

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

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

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

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

?>
[/php]

Lives Here
 
Join Date: Sep 2006
Posts: 12,070
#2: Jul 8 '08

re: problem with xml usage


Where did you get the code from?
Member
 
Join Date: May 2008
Posts: 118
#3: Jul 8 '08

re: problem with xml usage


Quote:

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.
Markus's Avatar
Moderator
 
Join Date: Jun 2007
Location: York, England, with wolves.
Posts: 4,948
#4: Jul 8 '08

re: problem with xml usage


Quote:

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...
Reply