The else portion of my code doesn’t work with a Kirby plugin. I use the domain.
http://www.domain.com?token=9393932939
When I use this simular code in php it works. When I put it in Kirby, the else portion doesn’t work. Also the main domain puts a / in front of my domain http://www.domain.com/?token=9393932939 like so.
So what I need to do is make it so that kirby can get the ?token=value from the url and put it in the webservice value. Any suggestions what I’m doing wrong? Thanks.
<?php
//Cookie check goes here. else get token from url. If cookie parse it and set variables for pendo.
// else do the below code.
// Check cookie exisits. if it does
// 2 parse it
// 3 set variables this prevents a unique request to the webservices each time.
if(isset($_COOKIE['resourceCenter'])){
This portion of the code works
}
else{
// if token exists get it from the url and get the value back from webservices. I shouldn't need an exception if the token is set and working. Although I thought about checking it just in case. But the token should be set and working.
if (isset($_GET['token'])) {
$token = $_GET['token'];
$tokenData = file_get_contents('https://gettoken.com?token='.$token);
// set cookie variables should still be set from the webservices. but create the cookie and serialize it.
$json = json_encode($tokenData);
setcookie('resourceCenter', $tokenData, time() + 3600, '/');
$roleSummary = json_decode($tokenData);
echo "somethingelse";
}else{
header("Location:https://google.com");
exit();
echo "somethingwrong";
}
}
?>