<?php require_once 'util.php'; require_once '/usr/local/nusoap/lib/nusoap.php'; nusoap_base::setGlobalDebugLevel(0); $wsdl = new nusoap_client('http://cdmo.baruch.sc.edu/webservices2/requests.cfc?wsdl'); $stations = explode('|', $_REQUEST['stations']); $params = explode('|', $_REQUEST['params']); $data = array(); for ($i = 0; $i < count($stations); $i++) { $result = $wsdl->call('exportSingleParamXML', array('tbl' => $stations[$i], 'numrecs' => '1', 'param' => $params[$i])); $col2idx = array(); foreach ($result['nds']['data']['r'] as $r) { $d = array(); // figure out the col mapping if (count($col2idx) == 0) { foreach ($r['c'] as $c) { array_push($col2idx, $c['!v']); } } else { foreach ($r['c'] as $c) { if (rtrim($c['!v']) != 'null') { $d[$col2idx[count($d)]] = rtrim($c['!v']); } } } } $d['station'] = $stations[$i]; array_push($data, $d); } date_default_timezone_set('UTC');
protected function getClient() { if (!isset($this->client) || !$this->client) { nusoap_base::setGlobalDebugLevel(0); $wsdl_path = $this->getWSDLLocation(); $cache = new nusoap_wsdlcache('/tmp', 86400); $wsdl = $cache->get($url); if (is_null($wsdl)) { $wsdl = new wsdl($wsdl_path, '', '', '', '', 5); $cache->put($wsdl); } $client = new nusoap_client($wsdl, 'wsdl'); //$client = new nusoap_client($wsdl_path, true); $client->decode_utf8 = false; //$client->setDebugLevel(9); //$client->clearDebug(); if ($client->getError()) { throw new Exception("Initialising soap client failed, invalid wsdl?"); } $this->client = $client; } return $this->client; }