Du befindest Dich im Archiv vom ABAKUS Online Marketing Forum. Hier kannst Du Dich für das Forum mit den aktuellen Beiträgen registrieren.

Wer kann mir sagen was für eine Datei das ist

Hier können Sie Ihre Fragen zum Thema Suchmaschinenoptimierung (SEO) / Positionierung stellen
Neues Thema Antworten
piranja
PostRank 2
PostRank 2
Beiträge: 52
Registriert: 04.12.2004, 15:47

Beitrag von piranja » 08.10.2005, 13:55

Hallo

ich hatte mal einen Seo, der u.a. diese Datei benutzt hat, welche auf meinem Server lag.
wer kann mir sagen was das für eine Datei ist bzw. wofür Sie benutzt wurde.
<?php
class HtmlSource
{
var $host;
var $port = 80;
var $page;
var $request;
var $httpversion = "1.0";
var $method = "GET";
var $timeout = 30;
var $striptags;
var $showsource;
var $strip_responseheader = true;
var $accept;
var $accept_encoding;
var $accept_language;
var $authorization;
var $content_length;
var $content_type;
var $date;
var $referer;
var $useragent='Keywordmaster DraculaRequester v1.0';

var $cookies = array();
var $getvars = array();
var $postvars = array();

function addPostVar($name,$value)
{
if (!empty($name) && !empty($value))
{
$this->postvars[] =$name."=".$value;
}
}
function addGetVar($name,$value)
{
if (!empty($name) && !empty($value))
{
$this->getvars[] = $name."=".$value;
}
}

function addCookie($name,$value)
{
if (!empty($name) && !empty($value))
{
$this->cookies[] = $name."=".$value;
}
}

function getSource()
{
// Error check
if (empty($this->httpversion))
{
$this->httpversion = "1.0";
}
if (empty($this->method))
{
$this->method = "GET";
}

// Make GET variables
$vars = "";
$cookiehead = "";
if (sizeof($this->getvars) >0 && $this->method == "GET")
{
$vars = "?";
$vars .= join($this->getvars,"&");
// Knock last '&' off
// Remove this..?
if (sizeof($this->getvars) >1)
{
$vars = substr($vars,0,strlen($vars) -1);
}
}
// Make POST variables
if (sizeof($this->postvars) >0 && $this->method == "POST")
{
$vars = "\r\n";
$strpostvar = join($this->postvars,"&");
$vars .= $strpostvar;
$vars .= "\r\n";
}

// Make Cookies
if (sizeof($this->cookies) >0)
{
$cookiehead = "Cookie: ";
$cookiehead .= join($this->cookies,"; ");
$cookiehead .= "\r\n";
}

// Make up request. Host isn't strictly needed except IIS winges
if ($this->method == "POST")
{
$this->content_length = strlen($strpostvar);
$this->content_type = "application/x-www-form-urlencoded";

$this->request = $this->method." ".$this->page." HTTP/".$this->httpversion."\r\n";
$this->request .= "Host: ".$this->host."\r\n";
$this->request .= $cookiehead;
$this->request .= $this->_makeRequest();
$this->request .= $vars."\r\n";
} else{
$this->request = $this->method." ".$this->page.$vars." HTTP/".$this->httpversion."\r\n";
$this->request .= "Host: ".$this->host."\r\n";
$this->request .= $cookiehead;
$this->request .= $this->_makeRequest();
$this->request .= "\r\n";
}

// Open socket to URL

$sHnd = fsockopen ($this->host, $this->port, $errno, $errstr, $this->timeout);
if ($sHnd)
{
fputs ($sHnd, $this->request);

// Get source
while (!feof($sHnd))
{
$result .= fgets($sHnd,128);
}

// Strip header
if ($this->strip_responseheader)
{
$result = $this->_stripResponseHeader($result);
}

// Strip tags
if ($this->striptags)
{
$result = strip_tags($result);
}
// Show the source only
if ($this->showsource && !$this->striptags)
{
$result = htmlentities($result);
$result = nl2br($result);
}
} else {
$result = "Unable to connect to ".$this->host." on port ".$this->port." ( ".$errstr.")";
}
return $result;
}

function _makeRequest()
{
if (!empty($this->accept))
{
$result .= "Accept: ".$this->accept."\r\n";
}
if (!empty($this->accept_encoding))
{
$result .= "Accept-Encoding: ".$this->accept_encoding."\r\n";
}
if (!empty($this->accept_language))
{
$result .= "Accept-Language: ".$this->accept_language."\r\n";
}
if (!empty($this->authorization))
{
$result .= "Authorization: Basic ".base64_encode($this->authorization)."\r\n";
}
if (!empty($this->content_length))
{
$result .= "Content-length: ".$this->content_length."\r\n";
}
if (!empty($this->content_type))
{
$result .= "Content-type: ".$this->content_type."\r\n";
}
if (!empty($this->date))
{
$result .= "Date: ".$this->date."\r\n";
}
if (!empty($this->referer))
{
$result .= "Referer: ".$this->referer."\r\n";
}
if (!empty($this->useragent))
{
$result .= "User-Agent: ".$this->useragent."\r\n";
}

return $result;
}

function _stripResponseHeader($source)
{
$headerend = strpos($source,"\r\n\r\n");
if (is_bool($headerend))
{
$result = $source;
} else{
$StrHeader = substr($source, 0, $headerend+4);
$ArHeader = array();
$ArHeader = split("\n", $StrHeader);
//echo "hallo: ".$ArHeader[0]."\n";
foreach($ArHeader as $TmpHeader)
{
list($TmpHeader1, $TmpHeader2) = explode(' ', $TmpHeader, 2);
if($TmpHeader1 == 'Location:')
header("Location: $TmpHeader2");
}
$result = substr($source,$headerend+4,strlen($source) - ($headerend+4));
}
return $result;
}

}
?>