public function request($endpoint, $isPost = false, $params = array()){
		$accessToken = $this->getAccessToken();
		if($accessToken === null){
			return null;
		}
		$params['accessToken'] = $accessToken->getAccessToken();
		$url = $this->getConfig()->getApiUrl().$endpoint;
		if(!$isPost){
			$url .= '?'.http_build_query($params);
		}
		$ch = curl_init($url);
		if($isPost){
			curl_setopt($ch, CURLOPT_POST, true);
			curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params));
		}
		curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
		curl_setopt($ch, CURLOPT_TIMEOUT,10);
		curl_setopt($ch, CURLOPT_VERBOSE, true);
		$output = curl_exec($ch);

		$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
		curl_close($ch);
		
		return array('output' => $output, 'code' => $httpcode);
	}
public function request($endpoint, $isPost = false, $params = array()){
		$accessToken = $this->getAccessToken();
		if($accessToken === null){
			return null;
		}
		$params['accessToken'] = $accessToken->getAccessToken();
		$url = $this->getConfig()->getApiUrl().$endpoint;
		if(!$isPost){
			$url .= '?'.http_build_query($params);
		}
		$ch = curl_init($url);
		if($isPost){
			curl_setopt($ch, CURLOPT_POST, true);
			curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params));
		}
		curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
		curl_setopt($ch, CURLOPT_TIMEOUT,10);
		curl_setopt($ch, CURLOPT_VERBOSE, true);
		$output = curl_exec($ch);

		$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
		curl_close($ch);
		
		return array('output' => $output, 'code' => $httpcode);
	}
public function request ( $ endpoint , $ isPost = false , $ params = array ( ) ) { $ accessToken = $ this -> getAccessToken ( ) ; if ( $ accessToken === null ) { return null ; } $ params [ 'accessToken' ] = $ accessToken -> getAccessToken ( ) ; $ url = $ this -> getConfig ( ) -> getApiUrl ( ) . $ endpoint ; if ( ! $ isPost ) { $ url .= '?' . http_build_query ( $ params ) ; } $ ch = curl_init ( $ url ) ; if ( $ isPost ) { curl_setopt ( $ ch , CURLOPT_POST , true ) ; curl_setopt ( $ ch , CURLOPT_POSTFIELDS , http_build_query ( $ params ) ) ; } curl_setopt ( $ ch , CURLOPT_RETURNTRANSFER , 1 ) ; curl_setopt ( $ ch , CURLOPT_TIMEOUT , 10 ) ; curl_setopt ( $ ch , CURLOPT_VERBOSE , true ) ; $ output = curl_exec ( $ ch ) ; $ httpcode = curl_getinfo ( $ ch , CURLINFO_HTTP_CODE ) ; curl_close ( $ ch ) ; return array ( 'output' => $ output , 'code' => $ httpcode ) ; }
Request an API endpoint with post or get method and given parameters. Returns null if no AccessToken is provided
@param string $endpoint
@param boolean $isPost
@param array $params
@return array|null
Request an API endpoint with post or get method and given parameters . Returns null if no AccessToken is provided