public static function submit($url, $params) {
    $Config = GiroCheckout_SDK_Config::getInstance();

    $ch = curl_init();

    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_HEADER, 1);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));

    // For Windows environments
    if( defined('__GIROSOLUTION_SDK_CERT__') ) {
      curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
      curl_setopt($ch, CURLOPT_CAINFO, str_replace('\\', '/', __GIROSOLUTION_SDK_CERT__));
    }

    // For Windows environments
    if( defined('__GIROSOLUTION_SDK_SSL_VERIFY_OFF__') && __GIROSOLUTION_SDK_SSL_VERIFY_OFF__ ) {
      curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
      curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
    }

    if ($Config->getConfig('CURLOPT_SSL_VERIFYPEER')) {
      curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, $Config->getConfig('CURLOPT_SSL_VERIFYPEER'));
    }

    if ($Config->getConfig('CURLOPT_CAINFO')) {
      curl_setopt($ch, CURLOPT_CAINFO, $Config->getConfig('CURLOPT_CAINFO'));
    }

    if ($Config->getConfig('CURLOPT_SSL_VERIFYHOST')) {
      curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, $Config->getConfig('CURLOPT_SSL_VERIFYHOST'));
    }

    if ($Config->getConfig('CURLOPT_CONNECTTIMEOUT')) {
      curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $Config->getConfig('CURLOPT_CONNECTTIMEOUT'));
    }

    // Begin Proxy
    if( $Config->getConfig('CURLOPT_PROXY') && $Config->getConfig('CURLOPT_PROXYPORT') ) {
      curl_setopt($ch, CURLOPT_PROXY, $Config->getConfig('CURLOPT_PROXY'));
      curl_setopt($ch, CURLOPT_PROXYPORT, $Config->getConfig('CURLOPT_PROXYPORT'));

      if($Config->getConfig('CURLOPT_PROXYUSERPWD')) {
        curl_setopt($ch, CURLOPT_PROXYUSERPWD, $Config->getConfig('CURLOPT_PROXYUSERPWD'));
      }
    }
    // End Proxy

    if ($Config->getConfig('DEBUG_MODE')) {
      curl_setopt($ch, CURLINFO_HEADER_OUT, 1);
    }

    $result = curl_exec($ch);

    if($Config->getConfig('DEBUG_MODE')) { GiroCheckout_SDK_Debug_helper::getInstance()->logRequest(curl_getinfo($ch),$params); }
    if($Config->getConfig('DEBUG_MODE')) { GiroCheckout_SDK_Debug_helper::getInstance()->logReply($result, curl_error($ch)); }

    if($result === false) {
      throw new Exception('cURL: submit failed.');
    }

    curl_close($ch);

    return self::getHeaderAndBody($result);
  }
public static function submit($url, $params) {
    $Config = GiroCheckout_SDK_Config::getInstance();

    $ch = curl_init();

    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_HEADER, 1);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));

    // For Windows environments
    if( defined('__GIROSOLUTION_SDK_CERT__') ) {
      curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
      curl_setopt($ch, CURLOPT_CAINFO, str_replace('\\', '/', __GIROSOLUTION_SDK_CERT__));
    }

    // For Windows environments
    if( defined('__GIROSOLUTION_SDK_SSL_VERIFY_OFF__') && __GIROSOLUTION_SDK_SSL_VERIFY_OFF__ ) {
      curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
      curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
    }

    if ($Config->getConfig('CURLOPT_SSL_VERIFYPEER')) {
      curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, $Config->getConfig('CURLOPT_SSL_VERIFYPEER'));
    }

    if ($Config->getConfig('CURLOPT_CAINFO')) {
      curl_setopt($ch, CURLOPT_CAINFO, $Config->getConfig('CURLOPT_CAINFO'));
    }

    if ($Config->getConfig('CURLOPT_SSL_VERIFYHOST')) {
      curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, $Config->getConfig('CURLOPT_SSL_VERIFYHOST'));
    }

    if ($Config->getConfig('CURLOPT_CONNECTTIMEOUT')) {
      curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $Config->getConfig('CURLOPT_CONNECTTIMEOUT'));
    }

    // Begin Proxy
    if( $Config->getConfig('CURLOPT_PROXY') && $Config->getConfig('CURLOPT_PROXYPORT') ) {
      curl_setopt($ch, CURLOPT_PROXY, $Config->getConfig('CURLOPT_PROXY'));
      curl_setopt($ch, CURLOPT_PROXYPORT, $Config->getConfig('CURLOPT_PROXYPORT'));

      if($Config->getConfig('CURLOPT_PROXYUSERPWD')) {
        curl_setopt($ch, CURLOPT_PROXYUSERPWD, $Config->getConfig('CURLOPT_PROXYUSERPWD'));
      }
    }
    // End Proxy

    if ($Config->getConfig('DEBUG_MODE')) {
      curl_setopt($ch, CURLINFO_HEADER_OUT, 1);
    }

    $result = curl_exec($ch);

    if($Config->getConfig('DEBUG_MODE')) { GiroCheckout_SDK_Debug_helper::getInstance()->logRequest(curl_getinfo($ch),$params); }
    if($Config->getConfig('DEBUG_MODE')) { GiroCheckout_SDK_Debug_helper::getInstance()->logReply($result, curl_error($ch)); }

    if($result === false) {
      throw new Exception('cURL: submit failed.');
    }

    curl_close($ch);

    return self::getHeaderAndBody($result);
  }
public static function submit ( $ url , $ params ) { $ Config = GiroCheckout_SDK_Config :: getInstance ( ) ; $ ch = curl_init ( ) ; curl_setopt ( $ ch , CURLOPT_URL , $ url ) ; curl_setopt ( $ ch , CURLOPT_POST , true ) ; curl_setopt ( $ ch , CURLOPT_POSTFIELDS , $ params ) ; curl_setopt ( $ ch , CURLOPT_RETURNTRANSFER , true ) ; curl_setopt ( $ ch , CURLOPT_HEADER , 1 ) ; curl_setopt ( $ ch , CURLOPT_HTTPHEADER , array ( 'Expect:' ) ) ; // For Windows environments if ( defined ( '__GIROSOLUTION_SDK_CERT__' ) ) { curl_setopt ( $ ch , CURLOPT_SSL_VERIFYPEER , 1 ) ; curl_setopt ( $ ch , CURLOPT_CAINFO , str_replace ( '\\' , '/' , __GIROSOLUTION_SDK_CERT__ ) ) ; } // For Windows environments if ( defined ( '__GIROSOLUTION_SDK_SSL_VERIFY_OFF__' ) && __GIROSOLUTION_SDK_SSL_VERIFY_OFF__ ) { curl_setopt ( $ ch , CURLOPT_SSL_VERIFYHOST , 0 ) ; curl_setopt ( $ ch , CURLOPT_SSL_VERIFYPEER , 0 ) ; } if ( $ Config -> getConfig ( 'CURLOPT_SSL_VERIFYPEER' ) ) { curl_setopt ( $ ch , CURLOPT_SSL_VERIFYPEER , $ Config -> getConfig ( 'CURLOPT_SSL_VERIFYPEER' ) ) ; } if ( $ Config -> getConfig ( 'CURLOPT_CAINFO' ) ) { curl_setopt ( $ ch , CURLOPT_CAINFO , $ Config -> getConfig ( 'CURLOPT_CAINFO' ) ) ; } if ( $ Config -> getConfig ( 'CURLOPT_SSL_VERIFYHOST' ) ) { curl_setopt ( $ ch , CURLOPT_SSL_VERIFYHOST , $ Config -> getConfig ( 'CURLOPT_SSL_VERIFYHOST' ) ) ; } if ( $ Config -> getConfig ( 'CURLOPT_CONNECTTIMEOUT' ) ) { curl_setopt ( $ ch , CURLOPT_CONNECTTIMEOUT , $ Config -> getConfig ( 'CURLOPT_CONNECTTIMEOUT' ) ) ; } // Begin Proxy if ( $ Config -> getConfig ( 'CURLOPT_PROXY' ) && $ Config -> getConfig ( 'CURLOPT_PROXYPORT' ) ) { curl_setopt ( $ ch , CURLOPT_PROXY , $ Config -> getConfig ( 'CURLOPT_PROXY' ) ) ; curl_setopt ( $ ch , CURLOPT_PROXYPORT , $ Config -> getConfig ( 'CURLOPT_PROXYPORT' ) ) ; if ( $ Config -> getConfig ( 'CURLOPT_PROXYUSERPWD' ) ) { curl_setopt ( $ ch , CURLOPT_PROXYUSERPWD , $ Config -> getConfig ( 'CURLOPT_PROXYUSERPWD' ) ) ; } } // End Proxy if ( $ Config -> getConfig ( 'DEBUG_MODE' ) ) { curl_setopt ( $ ch , CURLINFO_HEADER_OUT , 1 ) ; } $ result = curl_exec ( $ ch ) ; if ( $ Config -> getConfig ( 'DEBUG_MODE' ) ) { GiroCheckout_SDK_Debug_helper :: getInstance ( ) -> logRequest ( curl_getinfo ( $ ch ) , $ params ) ; } if ( $ Config -> getConfig ( 'DEBUG_MODE' ) ) { GiroCheckout_SDK_Debug_helper :: getInstance ( ) -> logReply ( $ result , curl_error ( $ ch ) ) ; } if ( $ result === false ) { throw new Exception ( 'cURL: submit failed.' ) ; } curl_close ( $ ch ) ; return self :: getHeaderAndBody ( $ result ) ; }
submits data by using curl to a given url

@param String url where data has to be sent to
@param mixed[] array data which has to be sent
@return array body of the response
submits data by using curl to a given url