public function request() 
	{
		
		if(!$this->getResource()) {
			
			$this->exception("No curl resource was found", debug_backtrace());
		}

		$resource = $this->getResource(); 
		curl_setopt($resource, CURLOPT_URL, $this->getUri());
		//setting curl options
		$headers = $this->getHeaders();

		if(!empty($headers)) {
			
			curl_setopt($resource, CURLOPT_HTTPHEADER, $headers);

			//curl_setopt($resource, CURLOPT_HEADER, true);	
		}

		$method = $this->getMethod();

		$curlMethod = '';
		switch ($method) {
			case CheckoutApi_Client_Adapter_Constant::API_POST:
				$curlMethod =  CheckoutApi_Client_Adapter_Constant::API_POST;
				break;
			case CheckoutApi_Client_Adapter_Constant::API_GET:
				$curlMethod =  CheckoutApi_Client_Adapter_Constant::API_GET;

				break;
			case CheckoutApi_Client_Adapter_Constant::API_DELETE:
			    $curlMethod = CheckoutApi_Client_Adapter_Constant::API_DELETE;
			break;
            case CheckoutApi_Client_Adapter_Constant::API_PUT:
                $curlMethod = CheckoutApi_Client_Adapter_Constant::API_PUT;
            break;
			default :
				
				$this->exception("Method currently not supported", debug_backtrace());
			break;
		}

        if($curlMethod != CheckoutApi_Client_Adapter_Constant::API_GET) {
            curl_setopt($resource, CURLOPT_CUSTOMREQUEST, $curlMethod);
        }

//		curl_setopt($resource , $curlMethod, true);

		if($method == CheckoutApi_Client_Adapter_Constant::API_POST || $method == CheckoutApi_Client_Adapter_Constant::API_PUT  ) {
			curl_setopt($resource, CURLOPT_POSTFIELDS, $this->getPostedParam());
		}

		curl_setopt($resource, CURLOPT_RETURNTRANSFER, true);
		curl_setopt($resource, CURLOPT_SSL_VERIFYPEER, false);


		$response = curl_exec($resource);
		$http_status = curl_getinfo($resource, CURLINFO_HTTP_CODE);

		if($http_status != 200 ) {
			$this->exception("An error has occurred while processing your transaction",
				array(
					'respond_code'=> $http_status,
					'curl_info' => curl_getinfo($resource),
					'respondBody'=>	$response,
					'postedParam' =>$this->getPostedParam(),
					'rawPostedParam' => $this->getRawpostedParam(),
					)
				);

		} elseif (curl_errno($resource)) {

			$info = curl_getinfo($resource);
			$this->exception("Curl issues ",$info);
		} 

 	    $this->setResource($resource);	
	    $this->setRespond($response);
		
		
		return $this;
	}
public function request() 
	{
		
		if(!$this->getResource()) {
			
			$this->exception("No curl resource was found", debug_backtrace());
		}

		$resource = $this->getResource(); 
		curl_setopt($resource, CURLOPT_URL, $this->getUri());
		//setting curl options
		$headers = $this->getHeaders();

		if(!empty($headers)) {
			
			curl_setopt($resource, CURLOPT_HTTPHEADER, $headers);

			//curl_setopt($resource, CURLOPT_HEADER, true);	
		}

		$method = $this->getMethod();

		$curlMethod = '';
		switch ($method) {
			case CheckoutApi_Client_Adapter_Constant::API_POST:
				$curlMethod =  CheckoutApi_Client_Adapter_Constant::API_POST;
				break;
			case CheckoutApi_Client_Adapter_Constant::API_GET:
				$curlMethod =  CheckoutApi_Client_Adapter_Constant::API_GET;

				break;
			case CheckoutApi_Client_Adapter_Constant::API_DELETE:
			    $curlMethod = CheckoutApi_Client_Adapter_Constant::API_DELETE;
			break;
            case CheckoutApi_Client_Adapter_Constant::API_PUT:
                $curlMethod = CheckoutApi_Client_Adapter_Constant::API_PUT;
            break;
			default :
				
				$this->exception("Method currently not supported", debug_backtrace());
			break;
		}

        if($curlMethod != CheckoutApi_Client_Adapter_Constant::API_GET) {
            curl_setopt($resource, CURLOPT_CUSTOMREQUEST, $curlMethod);
        }

//		curl_setopt($resource , $curlMethod, true);

		if($method == CheckoutApi_Client_Adapter_Constant::API_POST || $method == CheckoutApi_Client_Adapter_Constant::API_PUT  ) {
			curl_setopt($resource, CURLOPT_POSTFIELDS, $this->getPostedParam());
		}

		curl_setopt($resource, CURLOPT_RETURNTRANSFER, true);
		curl_setopt($resource, CURLOPT_SSL_VERIFYPEER, false);


		$response = curl_exec($resource);
		$http_status = curl_getinfo($resource, CURLINFO_HTTP_CODE);

		if($http_status != 200 ) {
			$this->exception("An error has occurred while processing your transaction",
				array(
					'respond_code'=> $http_status,
					'curl_info' => curl_getinfo($resource),
					'respondBody'=>	$response,
					'postedParam' =>$this->getPostedParam(),
					'rawPostedParam' => $this->getRawpostedParam(),
					)
				);

		} elseif (curl_errno($resource)) {

			$info = curl_getinfo($resource);
			$this->exception("Curl issues ",$info);
		} 

 	    $this->setResource($resource);	
	    $this->setRespond($response);
		
		
		return $this;
	}
public function request ( ) { if ( ! $ this -> getResource ( ) ) { $ this -> exception ( "No curl resource was found" , debug_backtrace ( ) ) ; } $ resource = $ this -> getResource ( ) ; curl_setopt ( $ resource , CURLOPT_URL , $ this -> getUri ( ) ) ; //setting curl options $ headers = $ this -> getHeaders ( ) ; if ( ! empty ( $ headers ) ) { curl_setopt ( $ resource , CURLOPT_HTTPHEADER , $ headers ) ; //curl_setopt($resource, CURLOPT_HEADER, true);	 } $ method = $ this -> getMethod ( ) ; $ curlMethod = '' ; switch ( $ method ) { case CheckoutApi_Client_Adapter_Constant :: API_POST : $ curlMethod = CheckoutApi_Client_Adapter_Constant :: API_POST ; break ; case CheckoutApi_Client_Adapter_Constant :: API_GET : $ curlMethod = CheckoutApi_Client_Adapter_Constant :: API_GET ; break ; case CheckoutApi_Client_Adapter_Constant :: API_DELETE : $ curlMethod = CheckoutApi_Client_Adapter_Constant :: API_DELETE ; break ; case CheckoutApi_Client_Adapter_Constant :: API_PUT : $ curlMethod = CheckoutApi_Client_Adapter_Constant :: API_PUT ; break ; default : $ this -> exception ( "Method currently not supported" , debug_backtrace ( ) ) ; break ; } if ( $ curlMethod != CheckoutApi_Client_Adapter_Constant :: API_GET ) { curl_setopt ( $ resource , CURLOPT_CUSTOMREQUEST , $ curlMethod ) ; } //		curl_setopt($resource , $curlMethod, true); if ( $ method == CheckoutApi_Client_Adapter_Constant :: API_POST || $ method == CheckoutApi_Client_Adapter_Constant :: API_PUT ) { curl_setopt ( $ resource , CURLOPT_POSTFIELDS , $ this -> getPostedParam ( ) ) ; } curl_setopt ( $ resource , CURLOPT_RETURNTRANSFER , true ) ; curl_setopt ( $ resource , CURLOPT_SSL_VERIFYPEER , false ) ; $ response = curl_exec ( $ resource ) ; $ http_status = curl_getinfo ( $ resource , CURLINFO_HTTP_CODE ) ; if ( $ http_status != 200 ) { $ this -> exception ( "An error has occurred while processing your transaction" , array ( 'respond_code' => $ http_status , 'curl_info' => curl_getinfo ( $ resource ) , 'respondBody' => $ response , 'postedParam' => $ this -> getPostedParam ( ) , 'rawPostedParam' => $ this -> getRawpostedParam ( ) , ) ) ; } elseif ( curl_errno ( $ resource ) ) { $ info = curl_getinfo ( $ resource ) ; $ this -> exception ( "Curl issues " , $ info ) ; } $ this -> setResource ( $ resource ) ; $ this -> setRespond ( $ response ) ; return $ this ; }
A method that do a request on provide uri and return itsel
@return CheckoutApi_Client_Adapter_Curl return self
Simple usage:
$adapter->request()->getRespond()
A method that do a request on provide uri and return itsel