phpCAS::serviceWeb PHP Method

serviceWeb() public static method

This method is used to access an HTTP[S] service.
public static serviceWeb ( string $url, &$err_code, &$output ) : boolean
$url string the service to access.
return boolean 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;
    }

Usage Example

 function getConnexionBar()
 {
     if (CASUser::checkAuth()) {
         $service = SITE_CAS_CONNEXIONBAR_URL;
         phpCAS::serviceWeb($service, $err_code, $output);
         $xml = simplexml_load_string($output);
         $result = $xml->xpath('/reportoutput/reportdata');
         return html_entity_decode($result[0]->asXML());
     } else {
         return "";
     }
 }
All Usage Examples Of phpCAS::serviceWeb