samedi 25 avril 2015

Display PHP array or XML in a HTML table


I have to develop two web service from different languages and combined these two using PHP. Normally web services contain PHP and I managed to combine two web services and get the combined XML output. but now i have to display these XML inside a HTML table. I tried to create HTML table manually but it doesn't work

this is my PHP code that combine two web services and get XML output

$PHPserv = $PHPwebservice . "ID.php?id=" . $encodedval;
        // header('Content-type:  text/xml');
        error_reporting(E_ALL);
        foreach(file($PHPserv) as $node)
            {
            $str = $node;
            }

        if (strlen($str) > 13)
            {
            $PHPresult->loadXML($str);
            $result1 = true;
            }

        $parray = array(
            'id' => $geturlval
        );
        $ASMXserv = new SoapClient($ASMXwebservice);
        $str = $ASMXserv->Listbirdstringbldryid($parray)->ListbirdstringbldryidResult->any;
        if (strlen($str) > 140)
            {
            $ASMXresult->loadXML($str);
            $result2 = true;
            }

        if ($result1 == true && $result2 == true)
            {
            $xmlRoot = $PHPresult->documentElement;
            foreach($ASMXresult->documentElement->firstChild->childNodes as $node2)
                {
                $node = $PHPresult->importNode($node2, true);
                $xmlRoot->firstChild->appendChild($node);
                }

            echo $PHPresult->saveXML();


}

After I commented line header('Content-type: text/xml'); it will output a plain HTML array (i think) but how can I put inside a HTML table

I have only 1 day left to complete this. Someone please help me


Aucun commentaire:

Enregistrer un commentaire