Exemple #1
0
 /**
  * Send the Curl post request
  *
  * @param $url  string where we send the xml request
  *
  * @return bool returns false if there is a curl error
  */
 private function sendRequest($url)
 {
     $this->curl = new cURL([CURLOPT_USERAGENT => self::CURL_AGENT]);
     $this->curl->setHeader('Content-Type', 'application/x-www-form-urlencoded;charset=UTF-8');
     $this->curl->setTimeout(self::CURL_TIMEOUT);
     try {
         $response = $this->curl->post($url, 'load=' . urlencode($this->request));
         $this->response = $response->getData();
     } catch (Exception $e) {
         return false;
     }
     return true;
 }
Exemple #2
0
 /**
  * Adyen_API constructor
  *
  * @access public
  * @param string $environment
  */
 public function __construct(Curl $curl, $environment = 'test')
 {
     $this->environment = $environment == 'live' ? 'live' : 'test';
     $this->hpp_url = $this->urls[$this->environment][self::DEFAULT_HPP_URL];
     $this->curl = $curl->setUseragent(self::CURL_USER_AGENT)->setTimeout(self::CURL_REQUEST_TIMEOUT);
 }