This method is used to access an HTTP[S] service.
public serviceWeb ( string $url, &$err_code, &$output ) : true | ||
$url | string | the service to access. |
return | true | on success, false otherwise (in this later case, $err_code gives the reason why it failed and $output contains an error message). |
/** * Verify that proxied-service Exceptions are caught and converted to error * codes in serviceWeb(). * * @return void */ public function testServiceWebServiceError() { $result = $this->object->serviceWeb('ssh://me.example.net', $err_code, $output); $this->assertFalse($result, "serviceWeb() should have returned false on a service error."); $this->assertEquals(PHPCAS_SERVICE_NOT_AVAILABLE, $err_code); $this->assertStringStartsWith("The service", $output); }
/** * This method is used to access an HTTP[S] service. * * @param string $url the service to access. * @param string &$err_code an error code Possible values are * PHPCAS_SERVICE_OK (on success), PHPCAS_SERVICE_PT_NO_SERVER_RESPONSE, * PHPCAS_SERVICE_PT_BAD_SERVER_RESPONSE, PHPCAS_SERVICE_PT_FAILURE, * PHPCAS_SERVICE_NOT_AVAILABLE. * @param string &$output the output of the service (also used to give an * error message on failure). * * @return bool true on success, false otherwise (in this later case, * $err_code gives the reason why it failed and $output contains an error * message). */ public static function serviceWeb($url, &$err_code, &$output) { phpCAS::traceBegin(); phpCAS::_validateProxyExists(); try { $res = self::$_PHPCAS_CLIENT->serviceWeb($url, $err_code, $output); } catch (Exception $e) { phpCAS::error(get_class($e) . ': ' . $e->getMessage()); } phpCAS::traceEnd($res); return $res; }