Hello,
How i can have value of Post in routes ?
Any this for have value ?
And where i can $respond as Header Content Application/json ?
if some one have a sample .. Thanks
How i can have value of Post in routes ?
PHP Code:
public function postActionSmsTest(Request $request, Response $response)
{
$GLOBALS['log']->warning( json_encode( $_POST ) ); // this give below
{"action":"outgoing","version":"30","phone_number" :"32470XXX","phone_id":"","phone_token":"","sen d_limit":"100","now":"1623005379580","settings_ver sion":"0","battery":"100","power":"2","network":"W IFI","log":"Checking for messages\n"}
$data = $request->getBodyContents(); // this give below
"action=outgoing&version=30&phone_number=32470XXX&phone_id=&phone_token=&send_limit=100&now=16230 06219586&settings_version=0&battery=100&power=2&network=WIFI&log=%5B9%3A03%3A39+pm%5D%0AChecking+for +messages%0A"
$data = $request->getBodyContents(); // No Result
$data = $request->getParsedBody(); // No result
$data = json_decode(json_encode($_POST)); // $data->action : this is OK
Any this for have value ?
And where i can $respond as Header Content Application/json ?
if some one have a sample .. Thanks
Comment