src/PaymentGateway.php
private function __sendFileGetContents($urlPath, $method, $param)
    {
        $url = trim($this->apiBaseUrl, '/') . '/' . trim($urlPath, '/');

        if ($method == 'GET') {
            $query = http_build_query($param);
            $url = $url . '?' . $query;
        }

        $opts = array('http' =>
            array(
                'method' => $method,
                'timeout' => '30',
                'max_redirects' => '10',
                'ignore_errors' => '1',
                'header' => 'Content-type: application/json',
                'content' => $method == 'POST' ? json_encode($param) : ''
            )
        );

        $context = stream_context_create($opts);
        $result = file_get_contents($url, false, $context);

        //get http status code
        $response_header = explode(' ', $http_response_header[0]);
        $httpCode = (int)$response_header[1];


        return (object)array(
            'code' => $httpCode,
            'response' => json_decode($result),
        );
    }
private function __sendFileGetContents($urlPath, $method, $param)
    {
        $url = trim($this->apiBaseUrl, '/') . '/' . trim($urlPath, '/');

        if ($method == 'GET') {
            $query = http_build_query($param);
            $url = $url . '?' . $query;
        }

        $opts = array('http' =>
            array(
                'method' => $method,
                'timeout' => '30',
                'max_redirects' => '10',
                'ignore_errors' => '1',
                'header' => 'Content-type: application/json',
                'content' => $method == 'POST' ? json_encode($param) : ''
            )
        );

        $context = stream_context_create($opts);
        $result = file_get_contents($url, false, $context);

        //get http status code
        $response_header = explode(' ', $http_response_header[0]);
        $httpCode = (int)$response_header[1];


        return (object)array(
            'code' => $httpCode,
            'response' => json_decode($result),
        );
    }
private function __sendFileGetContents ( $ urlPath , $ method , $ param ) { $ url = trim ( $ this -> apiBaseUrl , '/' ) . '/' . trim ( $ urlPath , '/' ) ; if ( $ method == 'GET' ) { $ query = http_build_query ( $ param ) ; $ url = $ url . '?' . $ query ; } $ opts = array ( 'http' => array ( 'method' => $ method , 'timeout' => '30' , 'max_redirects' => '10' , 'ignore_errors' => '1' , 'header' => 'Content-type: application/json' , 'content' => $ method == 'POST' ? json_encode ( $ param ) : '' ) ) ; $ context = stream_context_create ( $ opts ) ; $ result = file_get_contents ( $ url , false , $ context ) ; //get http status code $ response_header = explode ( ' ' , $ http_response_header [ 0 ] ) ; $ httpCode = ( int ) $ response_header [ 1 ] ; return ( object ) array ( 'code' => $ httpCode , 'response' => json_decode ( $ result ) , ) ; }
Use file_get_contents function for Send request

@param string $urlPath
@param string $method request method type , POST|GET
@param array  $param request parameters
@return object
Use file_get_contents function for Send request