insurance_id = !empty($insurance_id) ? (int)$insurance_id : 1; $this->partner_id = !empty($partner_id) ? (int)$partner_id : 360; $this->tracking = $tracking; $this->ad_id = 15; // Interner Parameter $this->referer_url = $referer_url; $this->css_url = $css_url; $this->go = $go; if ($mode == 'short') { $this->mode = $mode; $this->ad_id = 343; } } function get_start_url() { $insurance_id = (int)$this->insurance_id; $partner_id = (int)$this->partner_id; $ad_id = (int)$this->ad_id; $tracking = urlencode($this->tracking); $referer_url = urlencode($this->referer_url); $css_url = urlencode($this->css_url); $mode = urlencode($this->mode); $fp = fsockopen($this->hostname, 80, $errno, $errstr, 5); if (!$fp) { return NULL; } else { $out = "GET /show.php?insurance_id=$insurance_id&partner_id=$partner_id&ad_id=$ad_id&tracking=$tracking&referer_url=$referer_url&css_url=$css_url&mode=$mode&tool=$tool HTTP/1.0\r\n"; $out .= 'Host: ' . $this->hostname . "\r\n"; $out .= "Connection: Close\r\n\r\n"; fwrite($fp, $out); $result = ''; while (!feof($fp)) { $result .= fgets($fp, 128); } fclose($fp); $tmp = preg_split("/^(.*?)\r?\n\r?\n(.*)$/", $result); if (!empty($tmp[0]) && preg_match('/Location: ([^\n]*)/si', $tmp[0], $matches) == 1) { preg_match('/([a-z0-9]{32})/is', $result, $matches2); $this->set_session($matches2[1]); return trim($matches[1]); } else { return NULL; } return $result; } } function set_body($body) { $this->body = $body; } function get_body() { return $this->body; } function set_session($session) { $this->session = $session; } function get_session() { return $this->session; } function set_head($head) { $this->head = $head; } function get_head() { return $this->head; } function request($mode, $url, $parameter) { $data = ''; if ($mode == 'POST') { $fp = fsockopen($this->hostname, 80, $errno, $errstr, 5); if (!$fp) { return NULL; } else { $parameter['registered_ip'] = $_SERVER['REMOTE_ADDR']; $out = 'POST ' . $url . " HTTP/1.0\r\n"; $out .= 'Host: ' . $this->hostname . "\r\n"; $out .= "Content-type: application/x-www-form-urlencoded\r\n"; $param = ''; while (list($name, $value) = @each($parameter)) { $param[] = $name . '=' . urlencode($value); } $param = implode('&', $param); $out .= 'Content-length: ' . strlen($param) . "\r\n"; $out .= "Connection: close\r\n\r\n"; $out .= $param; fwrite($fp, $out); while (!feof($fp)) { $data .= fgets($fp, 128); } fclose($fp); // Follow Location-Header (we only expect internal Headers here) $tmp = preg_split("/^(.*?)\r?\n\r?\n(.*)$/", $data); if (!empty($tmp[0]) && preg_match('/Location: ([^\n]*)/is', $tmp[0], $matches) == 1) { if ($matches[1]{0} == '/') { $data = file_get_contents('http://' . $this->hostname . '/' . $this->get_session() . trim($matches[1])); } else { $data = file_get_contents('http://' . $this->hostname . '/' . $this->get_session() . '/' . trim($matches[1])); } } } } else { $parts = parse_url($url); if (isset($parts['host']) && $parts['host'] == $this->hostname) { $data = file_get_contents($url); } else { $data = 'access violation'; } } // Replace $data = strtr($data, array( 'method="post"' => 'method="get"', 'href="javascript:' => 'href="javascript:', 'src="http://www.' => 'src="http://www.', 'href="http://' => 'href="http://', 'href="' => 'href="' . $this->base_url, 'src="' => 'src="' . $this->base_url, ' ']*\>(.*)\<\/body/is', $data, $matches) == 1) { $this->set_body($matches[1]); } // Get head if (preg_match('/head\>(.*)\<\/head/is', $data, $matches) == 1) { $matches[1] = preg_replace('/(\.*\<\/title\>)/is', '', $matches[1]); $this->set_head($matches[1]); } return $data; } function handle() { $this->system_url = $_SERVER['SCRIPT_URI']; if (!empty($_REQUEST['page']) && !empty($_GET['t24session']) && preg_match('/^([a-z0-9]{32})$/is', $_GET['t24session'])) { $this->set_session($_GET['t24session']); $this->request('POST', '/' . $this->get_session() . '/show2.php', $_REQUEST); } else { $url = $this->get_start_url(); $this->request('GET', $url, NULL); } } } ?> Versicherungen im Preisvergleich