When I call endpoint from flash all the action is done well but the response is empty. The code is:
class AmfController extends Zend_Controller_Action {
public function indexAction()
{
$server = new Zend_Amf_Server();
$server->setProduction(false);
$server->setClass('Application_Model_Amf');
$response = $server->handle();
echo $response;
}
}
and
class Application_Model_Amf {
/**
*
* @param bytearray $data
* @param string $dateString
* @return int
*/
public function save($data, $dateString)
{
$dateString = str_replace(array('|', ':'), array('_', ''), $dateString);
//file_put_contents("$dateString.jpg", $data);
$r = new stdClass();
$r->error = 0;
return $r;
}
}
I also tried
public function save($data, $dateString)
{
$dateString = str_replace(array('|', ':'), array('_', ''), $dateString);
//file_put_contents("$dateString.jpg", $data);
return true;
}
but it worked neither - still empty response. How can I return response like this stdClass() ? Or only integer value 1 or 0?
The solution is to add die()
public function indexAction()
{
$server = new Zend_Amf_Server();
$server->setProduction(false);
$server->setClass('Application_Model_Amf');
$response = $server->handle();
echo $response;
die();
}