본문 바로가기
개발이야기/php

한글 맞춤법 검사기

by 세크티 2020. 7. 2.

네이버에 보면 맞춤법 검사기라고 있습니다.

 

여기 페이지를 파싱해서 맞춤법 검사를 하는 함수로 만들어 보았어요.

 

if(!function_exists('wordCheck')){
    function word_check($word){
        $word_encode = urlencode($word);
        $url = "https://m.search.naver.com/p/csearch/ocontent/util/SpellerProxy?q={$word_encode}&color_blindness=0";
        $result = file_get_contents($url);
        $result_decode = json_decode($result,true);
        return $result_decode['message']['result']['notag_html'];
    }
}

 

word_check('교정할 문자열')로 사용하시면됩니다.

'개발이야기 > php' 카테고리의 다른 글

리다이렉트시 referer 유지하기  (0) 2020.06.30

댓글