18 require_once
'config.php';
53 <title>
phpCAS proxy POST example</title>
54 <link rel=
"stylesheet" type=
'text/css' href=
'example.css'/>
57 <h1>
phpCAS proxy POST example</h1>
58 <?php require
'script_info.php' ?>
59 <p>the user
's login is <b><?php echo phpCAS::getUser(); ?></b>.</p> 60 <h2>Response from service <?php echo $serviceUrl; ?></h2> 64 // call a service and change the color depending on the result 66 $service = phpCAS::getProxiedService(PHPCAS_PROXIED_SERVICE_HTTP_POST); 67 $service->setUrl($serviceUrl); 68 $service->setContentType('application/x-www-form-urlencoded
'); 69 $service->setBody('favorite_color=blue
'); 71 if ($service->getResponseStatusCode() == 200) { 72 echo '<div
class=
"success">
'; 73 echo $service->getResponseBody(); 76 // The service responded with an error code 404, 500, etc. 77 echo '<div
class=
"error">
'; 78 echo 'The service responded with a
' 79 . $service->getResponseStatusCode() . ' error.
'; 80 echo $service->getResponseBody(); 83 } catch (CAS_ProxyTicketException $e) { 84 if ($e->getCode() == PHPCAS_SERVICE_PT_FAILURE) { 85 echo '<div
class=
"error">
'; 86 echo "Your login has timed out. You need to log in again."; 89 // Other proxy ticket errors are from bad request format (shouldn't happen)
static forceAuthentication()
static proxy($server_version, $server_hostname, $server_port, $server_uri, $changeSessionID=true, \SessionHandlerInterface $sessionHandler=null)
static setLogger($logger=null)
static setVerbose($verbose)
if($_SERVER['SERVER_PORT'] !=80 && $_SERVER['SERVER_PORT'] !=443) $curdir
static setNoCasServerValidation()