본문 바로가기
개발/php

php curl header 사용 예시 비즈엠 내 잔액 확인 api

by 향유 2021. 3. 29.

     function get($url, $params=array()){
        $url = $url.'?'.http_build_query($params, '', '&');
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        $response = curl_exec($ch);
        curl_close($ch);
        return $response;
    }

 

    function getMyPoint() {
        return $this->get('https://alimtalk-api.bizmsg.kr/v1/user/balance', array('userid'=>'', 'userkey'=>''));
    }

댓글