B
B
bkistav2014-11-25 17:40:29
PHP
bkistav, 2014-11-25 17:40:29

How to display data received by WSDL using PHP in html?

Hello.
I don't have much experience in SOAP and WSDL, so I have a question.
dpkr-service.php

<?php

if (!empty($_POST)) {
    $clientDPKR = new SoapClient("http://url-to.svc?wsdl", array('trace' => true));

    // $result = $client->name_of_procedure($arg1, $arg2, ...);
    $mkd = htmlspecialchars($_POST['mkd']);
    $param = array("year" => '$mkd');
    $resultMkd = $clientDPKR->GetCommonInfoMkd($param);
    print_r($mkd);
}

?>

We make a query for the year and output an array:
<?php require_once('dpkr-service.php'); ?>
<form action="<?php $_SERVER['PHP_SELF'] ?>" method="POST">
    <label for="mkd">MKD info:</label>
    <input type="number" min="2010" max="2040" name="mkd" placeholder="Year" />&nbsp;&nbsp;
    <input type="submit" />
</form>
<?php print '<pre>'; print_r($resultMkd); print '</pre>'; ?>

How can I generate the result in the form of an html table or list?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
FanatPHP, 2014-11-25
@FanatPHP

Accessing the elements of objects and arrays has nothing to do with SOAP and WSDL.
An object property is accessed like this: $obj->svoistvo
An array element is accessed by $array[index], but arrays are usually iterated with foreach()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question