curl 엔코딩속성

매출이 오르면 내리는 수수료! 지금 수수료센터에서 전자결제(PG)수수료 비교견적 신청해 보세요!
curl 엔코딩속성

QA

curl 엔코딩속성

본문

아래와 같이 하면.. 생성된 파일엔코딩속성이 euc_kr로 자꾸 저장입니다.

이유가 멀까요? 그리고 어떻게 해야 정상적으로..UTF-8로 저장될까요?

 

<?php

$header = "Content-type: application/x-www-form-urlencoded;charset=UTF-8";

$ch = curl_init("xxx.schedule_fuel.php");

 

$fp = fopen("schedule.csv", "w");

 

curl_setopt($ch, CURLOPT_FILE, $fp);

curl_setopt($ch, CURLOPT_HEADER,  $header);

curl_setopt($ch, CURLOPT_ENCODING , "UTF-8");

curl_exec($ch);

curl_close($ch);

fclose($fp);

 

 echo("complete");  

?>

 

#12

이 질문에 댓글 쓰기 :

답변 1

http://php.net/manual/kr/function.curl-setopt.php 내용 중 CURLOPT_ENCODING 은 

 

http://static.se2.naver.com/static/img/bg_quote2.gif) 0 3px no-repeat;color:#888888;">

The contents of the "Accept-Encoding: " header. This enables decoding of the response. Supported encodings are "identity", "deflate", and "gzip". If an empty string, "", is set, a header containing all supported encoding types is sent. 

라고 명시되어 있습니다. UTF-8 등의 문자셋을 지정하는 부분이 아닙니다.

 

파일을 UTF-8로 저장하는 것은 http://stackoverflow.com/questions/10761411/php-curl-utf-8-charset

참고하셔서 코드를 테스트해보시기 바랍니다.

답변을 작성하시기 전에 로그인 해주세요.
전체 246
QA 내용 검색
filter #12 ×

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT