<!-- ideone.com API sample This script shows how to use ideone api. --> <style> th {padding: 5px; background-color: #DDDDDD;} td {padding: 5px; min-width: 70px; text-align: center;} td {border-bottom: 1px solid #DDDDDD;} </style> <?php // creating soap client $client = new SoapClient("http://ideone.com/api/1/service.wsdl"); // calling test function $testArray = $client->testFunction("test", "test"); // printing returned values echo "<table>\n"; echo "<tr><th>key</th><th>value</th><th>string</th><th>float</th><th>integer</th><th>bool</th></tr>\n"; foreach ($testArray as $k => $v) { echo "<td>" . $k . "</td><td>" . $v . "</td><td>" . is_string($v) . "</td><td>" . is_float($v) . "</td><td>" . is_integer($v) . "</td><td>" . is_bool($v) . "</td><td>\n"; echo "</tr>\n"; } echo "</table>\n"; ?>
<?php /** * SoapClient */ $client = new SoapClient(null, array('location' => 'http://127.0.0.1/webService/soap/server.php', 'uri' => 'http://127.0.0.1/')); $result = $client->testFunction(); // $result = $client->testClass(); var_dump($result);
/** * Any extra validation checks needed for the settings * form for this assignment type * * See lib/formslib.php, 'validation' function for details */ function form_validation($data, $files) { $errors = array(); if (substr($data['language'], -6) == 'ideone') { // ideone.com do not support multi-files // TODO: do not hardcode ideone here. judge should has support_multifile() function if ($data['var1'] > 1) { $errors['var1'] = get_string('onefileonlyideone', 'local_onlinejudge'); } if (empty($data['ideoneuser'])) { $errors['ideoneuser'] = get_string('ideoneuserrequired', 'local_onlinejudge'); } if (empty($data['ideonepass'])) { $errors['ideonepass'] = get_string('ideoneuserrequired', 'local_onlinejudge'); } else { if (!empty($data['ideoneuser'])) { // test username and password // creating soap client $client = new SoapClient("http://ideone.com/api/1/service.wsdl"); // calling test function $testArray = $client->testFunction($data['ideoneuser'], $data['ideonepass']); if ($testArray['error'] == 'AUTH_ERROR') { $errors['ideoneuser'] = $errors['ideonepass'] = get_string('ideoneautherror', 'local_onlinejudge'); } } } } return $errors; }