xmldata = new DOMDocument(); } /** * Return the xml results. */ function getResult() { return $this->xmlresult; } /** * Connect with the remote client. */ function action($action, $arr = array()) { if (is_string($action)) { if (is_array($arr)) { if (count($arr)) { $request = $this->xmldata->createElement("PARAMETERS"); $this->xmldata->appendChild($request); foreach ($arr as $key => $val) { $key = strtoupper($key); $request->appendChild($this->xmldata->createElement($key, $val)); } } $posted = array( 'username' => SUWP_USERNAME_MODELLIST_SUAPIPROVIDERNUM, 'apiaccesskey' => SUWP_API_ACCESS_KEY_MODELLIST_SUAPIPROVIDERNUM, 'action' => $action, 'requestformat' => SUWP_REQUESTFORMAT_MODELLIST_SUAPIPROVIDERNUM, 'parameters' => $this->xmldata->saveHTML(), ); $crul = curl_init(); curl_setopt($crul, CURLOPT_HEADER, FALSE); curl_setopt($crul, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); // curl_setopt($crul, CURLOPT_FOLLOWLOCATION, TRUE); By default. curl_setopt($crul, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($crul, CURLOPT_URL, SUWP_DHRUFUSION_URL_MODELLIST_SUAPIPROVIDERNUM . '/api/index.php'); curl_setopt($crul, CURLOPT_POST, TRUE); curl_setopt($crul, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($crul, CURLOPT_POSTFIELDS, $posted); $response = curl_exec($crul); if (curl_errno($crul) != CURLE_OK) { echo curl_error($crul); curl_close($crul); } else { curl_close($crul); if ($this->debug) { // echo ""; By default. } return (json_decode($response, TRUE)); } } } return FALSE; } }