
php.ini 파일에서 mbstring.http_output 설정을 변경하면 php에서 http 요청을 보낼 때 charset을 지정할 수 있습니다. 예를 들어, php.ini 파일에서 mbstring.http_output = "UTF-8"로 설정하면 php에서 http 요청을 보낼 때 기본적으로 UTF-8 charset을 사용합니다.
php.ini 파일에서 mbstring.http_output 설정을 변경한 후에 php에서 http 요청을 보낼 때 charset을 지정하는 방법은 다음과 같습니다.
#hostingforum.kr
php
$ch = curl_init();
$ch = curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_URL => 'http://example.com',
CURLOPT_HTTPHEADER => [
'Content-Type: application/json; charset=UTF-8', // charset을 지정합니다.
],
]);
$response = curl_exec($ch);
curl_close($ch);
또한, `curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json; charset=UTF-8']);`와 같이 사용할 수 있습니다.
2025-04-10 01:13