function playerPath($id)
{
    checkParameter($id);
    return url("/players/{$id}");
}
示例#2
0
</head>

<body>
<?php 
try {
    // Helper function to check query parameters.
    function checkParameter($param)
    {
        if (!isset($_REQUEST[$param])) {
            echo "Missing <code>" . $param . "</code> parameter in query string.";
            exit(0);
        }
    }
    checkParameter("agreementNumber");
    checkParameter("username");
    checkParameter("password");
    $me = $_SERVER['PHP_SELF'];
    $wsdlUrl = 'https://api.e-conomic.com/secure/api1/EconomicWebservice.asmx?WSDL';
    $client = new SoapClient($wsdlUrl, array("trace" => 1, "exceptions" => 1));
    $client->Connect(array('agreementNumber' => $_REQUEST['agreementNumber'], 'userName' => $_REQUEST['username'], 'password' => $_REQUEST['password']));
    if ($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['action'] == 'create_debtor') {
        try {
            $debtorGroupHandles = $client->debtorGroup_GetAll()->DebtorGroup_GetAllResult->DebtorGroupHandle;
            $firstDebtorGroup = $debtorGroupHandles[0];
            $newDebtorHandle = $client->Debtor_Create(array('number' => $_POST['debtor_number'], 'debtorGroupHandle' => $firstDebtorGroup, 'name' => $_POST['debtor_name'], 'vatZone' => 'EU'))->Debtor_CreateResult;
            $client->Debtor_SetAddress(array('debtorHandle' => $newDebtorHandle, 'value' => $_POST['debtor_address']));
            print "<p>A new debtor has be created.</p>";
        } catch (Exception $exception) {
            print "<p><b>Could not create debtor.</b></p>";
            print "<p><i>" . $exception->getMessage() . "</i></p>";
        }