function send() { if ($this->isValid()) { /* * if SOAP is installed, try to perform a SOAP request * else, try to use cURL * else, throw an error message that neither of those are installed */ if (class_exists("SoapClienttt")) { #if(false){ $client = new SoapClient('https://www.mPAY24.com/soap/etp/1.4/ETP.wsdl', array('login' => 'u' . $this->merchantid, 'password' => 'password', 'exceptions' => FALSE)); // if we are on test system, override the Location set within the WSDL if ($this->etp_url == "https://test.mPAY24.com/app/bin/etpv5") { $client->__setLocation('https://test.mPAY24.com/app/bin/etpproxy_v14'); } // perform the request $this->response = $client->SelectPayment(array('mdxi' => $this->xmlfile, 'merchantID' => $this->merchantid, 'getDataURL' => '', 'tid' => '')); } elseif (function_exists("curl_init")) { #}if(false){ // build Request $this->buildRequest(); // send request; $ch = curl_init($this->etp_url); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $this->request); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // TODO: Move proxy information to a more secure area, // e.g. a configuration file outside the web servers // document root. #curl_setopt($ch, CURLOPT_PROXY, 'aaa.bbb.ccc.ddd:port'); #... // NOT FOR PRODUCTION USE #curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); // uncomment the following line in case you experience trouble regarding cURL SSL certificate errors // Plese download cacert.pem from http://curl.haxx.se/docs/caextract.html #curl_setopt($ch, CURLOPT_CAINFO, "./cacert.pem"); // get response $this->response = curl_exec($ch); // catch errors $ch_error = curl_error($ch); if (empty($this->response) || !empty($ch_error)) { $this->response = "STATUS=ERROR&RETURNCODE=cURL+-+" . urlencode(curl_error($ch)); } curl_close($ch); } else { $this->response = "STATUS=ERROR&RETURNCODE=Your+PHP+installation+does+not+meet+either+of+the+following+requirements%3A%3Cul%3E%3Cli%3E%3Ca+href%3D%27http%3A%2F%2Fwww.php.net%2FcURL%27%3EcURL%3C%2Fa%3E+or%3C%2Fli%3E%3Cli%3E%3Ca+href%3D%27http%3A%2F%2Fwww.php.net%2FSOAP%27%3ESOAP%3C%2Fa%3E%3C%2Fli%3E%3C%2Ful%3E"; } } }