<?php $wsdl = 'http://www.comunio.es/soapservice.php?wsdl'; $trace = true; $exceptions = true; $options = array('trace' => $trace, 'exceptions' => $exceptions); try { $client = new SoapClient($wsdl, $options); $funciones = $client->__getFunctions(); $userid = $client->getuserid("loko"); $response = $client->getlogin($userid); $response2 = $client->getusersname($userid); $response3 = $client->getcommunityid($userid); } catch (Exception $e) { echo "Error! "; echo $e->getMessage(); echo 'Last response: ' . $client->__getLastResponse(); } echo "{$response}\n{$response2}\n{$response3}\n"; foreach ($funciones as $key => $value) { echo "{$value} \n"; }
{ $error = array("error" => $e->getMessage()); echo json_encode($error); } $app->error('handleError'); function myErrorHandler($errorCode, $errorMessage, $errorFile, $errorLinenumber) { handleError($errorMessage); } set_error_handler("myErrorHandler"); set_exception_handler("myErrorHandler"); $app->get('/points/:user', function ($user) use($app) { try { $urlSoapWSDL = 'http://www.comunio.co.uk/soapservice.php?wsdl'; $soapClient = new SoapClient($urlSoapWSDL); $userId = $soapClient->getuserid($user); $lineup = getLineup($userId); $playersInfo = []; for ($i = 0; $i < count($lineup); $i++) { array_push($playersInfo, getPlayerInfo($lineup[$i])); } $dates = explode(',', $app->request()->get('dates')); $ratings = []; for ($k = 0; $k < count($playersInfo); $k++) { array_push($ratings, getPlayerRating($playersInfo[$k], $dates)); } echo json_encode($ratings); } catch (Exception $e) { throw $e; } });