File PHP convertire in XML

<?
function parseToXML ( $htmlStr )
{
$xmlStr = str_replace ( '<' , '&lt;' , $htmlStr );
$xmlStr = str_replace ( '>' , '&gt;' , $xmlStr );
$xmlStr = str_replace ( '"' , '&quot;' , $xmlStr );
$xmlStr = str_replace ( "'" , '&apos;' , $xmlStr );
$xmlStr = str_replace ( "&" , '&amp;' , $xmlStr );
return
$xmlStr ;
}

/ / Start file XML, nodo principale echo
; echo '<items>';

echo '<voce';
. parseToXML ( stripslashes ( $sName )) . '" ' ; 'name = echo "' parseToXML (stripslashes ($ sName)). '".';
. parseToXML ( stripslashes ( $sAddress )) . '" ' ; 'address = echo "' parseToXML (stripslashes ($ sAddress)). '".';
. parseToXML ( $iPrice ) . '" ' ; 'prezzo = echo "' parseToXML ($ iPrice). '".';
. parseToXML ( $sLink ) . '" ' ; 'link = echo "' parseToXML ($ slink). '".';
. parseToXML ( stripslashes ( $tDetails )) . '" ' ; echo 'details = "' parseToXML (stripslashes ($ tDetails)). '".';
. parseToXML ( stripslashes ( $sOther )) . '" ' ; '= altro echo "'. parseToXML (stripslashes ($ sOther)). '"';
; echo '/>';

/ / Fine del file XML
; echo '</ item>';

?>

Puoi lasciare una risposta , oppure trackback dal tuo sito.

Lascia un commento

Devi essere loggato per lasciare un commento.