I’m developing our new Facebook game and I decided to use our dedicated webhosting service insted of VPS. I faced two main problem: first I would like to run my application on a Facebook tab where signed request is a good solution for many problem. Second was a size problem of signed request which caused by Suhosint on the webhosting server.
Handling Signed request on multiple pages
Facebook automaticly send signed request parameter to all application on a tab with a HTTP Post parameter. A prety simple thing to query this parameter from PHP. I’m using Zend Framework with Facebook PHP SDK, so I can query this parameter this way:
$signed_request = $this->getRequest()->getParam('signed_request');
Problem comes when I would like to link another page inside my application. For this new linked page Facebook isn’t give signed request automaticly and I can’t reach functions like “is actual user like my page?”. To solve this problem I need to pass signed request parameter to every new page inside links. First I added this parameter to my view and then i can use it inside my links..
In Controller class:
$this->view->signed_request = $this->getRequest()-> getParam('signed_request');
<a title="My title" href="<?=$this->baseUrl('/pic?signed_request='. $this->signed_request) ?>">
Suhosin get.max_value_length problem
Every production webserver should have Suhosin. If it’s configured with default parameters we can pass maximum 512 byte inside GET parameters. The problem is signed request parameter usualy longer than this. I need to set up this parameter inside php.ini for minimum 1024 byte:
suhosin.get.max_value_length = 1024