Example #1
0
<br>
<br>
Obtained Data (the above code is executed actually)<br>
<div class="res2">
<?php 
// set parameters
$mzs = array('80', '85');
$inte = "100";
$tol = "0.3";
$inst = array("all");
$ion = "Negative";
$params = array("mzs" => $mzs, "relativeIntensity" => $inte, "tolerance" => $tol, "instrumentTypes" => $inst, "ionMode" => $ion, "maxNumResults" => 0);
// call method
$soap = new SoapClient('http://www.massbank.jp/api/services/MassBankAPI?wsdl');
try {
    $res = $soap->searchPeakDiff($params);
} catch (SoapFault $e) {
    echo $e->getMessage();
    return;
}
// display obtained data
$ret = $res->return;
echo "<table>\n";
for ($i = 0; $i < $ret->numResults; $i++) {
    $info = $ret->results[$i];
    echo "<tr>\n";
    echo "<td>{$info->title}</td>";
    echo "<td>{$info->formula}</td>";
    echo "<td>{$info->exactMass}</td>";
    echo "<td>{$info->id}</td>\n";
    echo "</tr>\n";