Example #1
0
<br>
<br>
Obtained Data (the above code is executed actually)<br>
<div class="res2">
<?php 
$mzs = array('273.096', '289.086', '290.118', '291.096', '292.113', '579.169', '580.179');
$inte = array('300', '300', '300', '300', '300', '300', '300');
$unit = "unit";
$tol = "0.3";
$cutoff = "50";
$inst = array("all");
$ion = "Positive";
$params = array("mzs" => $mzs, "intensities" => $inte, "unit" => $unit, "tolerance" => $tol, "cutoff" => $cutoff, "instrumentTypes" => $inst, "ionMode" => $ion, "maxNumResults" => 20);
$soap = new SoapClient('http://www.massbank.jp/api/services/MassBankAPI?wsdl');
try {
    $res = $soap->searchSpectrum($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->score}</td>";
    echo "<td>{$info->title}</td>";
    echo "<td>{$info->formula}</td>";
    echo "<td>{$info->exactMass}</td>";
    echo "<td>{$info->id}</td>\n";