Hi,
Setting cookie functionality is not working when I'm calling a route fro PHP file_get_contents method? and It's working with jQuery $.ajax. What is the mistake i've done? Please help me to solve this.
Route:
$api->addGet('/setmycookie/{cookievalue}', array('controller' => 'myController', 'action' => 'index'));
Controller:
public function indexAction($cookievalue) { session_start();
$this->cookies->set('myCookie', $cookievalue, time() + 15 * 86400); $this->cookies->send(); $this->response->setResponse(array("status" => "success")); return $this->response; }
Front End Trigger:
$data = file_get_contents("https://domain.com/api/setmycookie/mycookievalue");