Hi,
I’m very confuse, so i going to see if i understood well. As the following code indicates , in order to retrieve some user information, i’m using methods of class, each methods of this class, has a diferent behavior, such as : get human tasks and so on. If you take a look in this code , we can see that it created a cookie named “cookie_LOGIN.txt”, into login method and “cookie_logoutservice.tx” into logout method, so, how this works?, that is, i must to put all “php” files in the same folder where are there the file of cookie?
public function Login($conexio,$user,$password){
$baseURL = 'http://localhost:8080/bonita/';
//$data = array('username' =>'walter.bates', 'password' => 'bpm', 'redirect' => 'false');
$data = array('username' =>$user, 'password' => $password, 'redirect' => 'false');
curl_setopt($conexio, CURLOPT_URL, $baseURL.'loginservice');
curl_setopt($conexio, CURLOPT_POST, 1);
curl_setopt($conexio, CURLOPT_POSTFIELDS,http_build_query($data));
curl_setopt($conexio, CURLOPT_RETURNTRANSFER, true);
$tmpfname = dirname(__FILE__).'/cookie_LOGIN.txt';
curl_setopt($conexio, CURLOPT_COOKIEJAR, $tmpfname);
curl_setopt($conexio, CURLOPT_COOKIEFILE, $tmpfname);
curl_setopt($conexio, CURLOPT_VERBOSE, true);
$verbose = fopen('curlLOGIN.log', 'a+');
curl_setopt($conexio, CURLOPT_STDERR, $verbose);
$logejat=curl_exec($conexio);
return $logejat;
}
public function Logout($conexio){
$baseURL = 'http://localhost:8080/bonita/logoutservice';
curl_setopt($conexio, CURLOPT_URL,$baseURL);
curl_setopt($conexio, CURLOPT_POST, 0);
curl_setopt($conexio, CURLOPT_RETURNTRANSFER, true);
$tmpfname = dirname(__FILE__).'/cookie_logoutservice.txt';
curl_setopt($conexio, CURLOPT_COOKIEJAR, $tmpfname);
curl_setopt($conexio, CURLOPT_COOKIEFILE, $tmpfname);
$logout=curl_exec($conexio);
curl_close($conexio);
return $logout;
}