0
내 codeigniter 프로젝트에서 sms 템플릿을 등록하기위한 API를 통합해야합니다. 이건 내 코드입니다 :API에 대한 콜백 URL
$postdata = array('userid' => 'user',
'password' => '[email protected]',
'template' => 'Demo template',
'callback_url' => base_url().'API/templateCallback'
);
$postdata = json_encode($postdata);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://example.com/TemplateRegistration2/registerTemplate.jsp");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$postdata);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec ($ch);
curl_close ($ch);
$response = json_decode($response);
print_r($response);
는 응답이 같은 JSON 객체가 될 것입니다,
{"req_id":"809ff62f-74a9-45a5-9cb5-5e60763289af","status":"0" ,"comment":"OK"}
하지만 난 내 templateCallback이 JSON 객체를 읽는 방법() 함수. 동일한 기능을 수행하는 함수가 내장되어 있습니까?