<?php
#=========================#
# Ekipa: Twoja-Strona.Net |
# http://Twoja-Strona.Net |
# Update: v1.1 |
#=========================#
Class URL {
var $url;
var $code;
var $text;
var $czas;
var $port;
var $headers;
var $notatka;
var $error;
var $log;
function START_URL($url, $port="80", $time="15", $headers="HTTP/1.0"){
$this->port = $port;
$this->czas = $time;
$this->headers = $headers;
$http = @parse_url($url);
if($http['host']!=""){
$http_url = @fsockopen($http['host'], $this->port, $errno, $errstr, $this->czas);
$notka = "";
if($http_url){
@socket_set_blocking($http_url, false);
@socket_set_timeout($http_url, $this->czas);
@fputs($http_url, "HEAD ".$url." ".$this->headers."\r\n\r\n");
while(!@feof($http_url)){$notka .= @fgets($http_url,1024);}
@fclose($http_url);
}else{$this->log = $errstr." (".$errno.")<br>"; return false;}
}else{$this->log = "B³êdny URL<br>"; return false;}
$this->notatka = $notka; return true;
}
function LOG_URL(){
return $this->log;
}
function CODE_URL($code, $text="", $error=""){
$this->code = $code;
$this->text = $text;
$this->error = $error;
if(@is_numeric($code)){
if(eregi("HTTP/1.. ".$this->code, $this->notatka)){
echo $this->text; return true;
}else{echo $this->error; return false;}
}else{echo $this->error; return false;}
}
}
?>