寧몸鑒앴꽃섞잚
2018-09-07 14:28
릿齡덜쯤 덜쯤흔苟:
<?
//쇗휭php4php5
//넋埼鱗諒蠟乖갖Linux)
//젬溝QQ733905
//숌데딧痰렘랬
/*
<?
include(ugs.php);//콱옵鹿苟潼굶ugs.phps횔빈路츱츰槨ugs.php
$ugs=newugs();
$url=
$ugs->seturl($url);
$ugs->gather();
//............侶쟁옵鹿딧痰굶잚쟁돨페劍렘랬,뚤$ugs->value_隣딧憐,
鹿찮璃퀭돨狼헹
$content=$ugs->getcontent();
print($content);
?>
*/
classugs
{
var$value_;//커깃코휭
var$src_;//커깃URL뒈囹
functionseturl($url)
{
$this->src_=$url;
}
functiongetcontent()
{
return$this->value_;
}
functiongetfile($url)
//삿혤커깃
{
$url_parsed=parse_url($url);
$host=$url_parsed[host];
$port=$url_parsed[port];
if($port==0)$port=80;
$path=$url_parsed[path];
if(empty($path))
$path=/;
if($url_parsed[query]!=)
$path.=?.$url_parsed[query];
$out=GET$pathHTTP/1.0\r\nHost:$host\r\n\r\n;
$fp=fsockopen($host,$port,$errno,$errstr,30);
fwrite($fp,$out);
$body=false;
while(!feof($fp))
{
$s=fgets($fp,1024);
if($body)$in.=$s;
if($s==\r\n)
$body=true;
}
fclose($fp);
return$in;
}
functiongetfile_curl($url)
{
$curl=/usr/local/bin/curl;//pathtoyourcurl
$curl_options=-s--connect-timeout10--max-time10;
//curl痰랬헝꽝옘curl--help샀諒mancurl
//curl꽝鑒렷끽裂료말,옵鹿친콰몹蘆啞응포(agent)옵鹿?阮?eferer
$cmd=$curl$curl_options$url;
@exec($cmd,$o,$r);
if($r!=0)
{
return낚珂;
}
else
{
$o=join(,$o);
return$o;
}
}
functiongather_curl($curl)
{
$http=$this->getfile_curl($this->src_);
return$this->value_=$http;
}
functiongather_array($url)
{
returnfile($url);
}
functiongather()
//역迦澗섞
{
$http=$this->getfile($this->src_);
return$this->value_=$http;
}
functiongather_local($toline=true)
//뇹잿굶뒈匡숭
{
if($toline)
{
$http=file($this->src_);
return$this->value_=$this->BytesToBstr($http);
}
else
{
$http=file($this->src_);
return$this->value_=$http;
}
}
functionnoReturn()
//?쓱暈卍돐뿅?
{
$this->value_=str_replace(\n,,$this->value_);
$this->value_=str_replace(\r,,$this->value_);
}
functionchange($oldStr,$str)
//뚤澗섞돕돨코휭櫓돨몸깎俚륜눔痰劤令뫘뻣/렘랬
//꽝鑒롸깎角앉俚륜눔,劤俚륜눔
{
$this->value_=str_replace($oldStr,$str,$this->value_);
}
functioncut($start,$end,$no=1,$comprise=)
//객寧땍看棺俚륜눔뚤澗섞돨코휭쏵契꼴숑(꼇관윅看棺俚륜눔)렘랬
//$no극伎角1,23...꼇豚冀角0
//$comprise옵鹿朞嶝start샀諒end샀諒all샀諒痂척떼꼇輕
{
$string=explode($start,$this->value_);
//print_r($string);
$string=explode($end,$string[$no]);
//print_r($string);
switch($comprise){
casestart:
$string=$start.$string[0];
break;
caseend:
$string=$string[0].$end;
break;
caseall:
$string=$start.$string[0].$end;
break;
default:
$string=$string[0];
}
return$this->value_=$string;
}
functionfilt($head,$bot,$str,$no=1,$comprise=)
//객寧땍看棺俚륜눔뚤澗섞돨코휭痰劤令쏵契競뻣(꼇관윅看棺俚륜눔)렘랬
//꽝鑒롸깎角看俚륜눔,棺俚륜눔,劤令,劤令貫왕橙槨법쫀
{
$tmp_v=$this->value_;
$tmp=$this->cut($head,$bot,$no,$comprise);
return$this->value_=str_replace($tmp,$str,$tmp_v);
}
functionlocal()
{
//쉥澗섞돨코휭櫓돨없뚤URL뒈囹맣槨굶뒈宮뚤뒈囹
//뻘청茄君
}
functionreplaceByReg($patrn,$str)
//뚤澗섞돨코휭櫓돨륜북攣橙깊댐駕돨俚륜눔痰劤令쏵契競뻣/렘랬
//꽝鑒角콱菱땍屢돨攣橙깊댐駕,劤令
{
return$this->value_=join(,preg_replace($patrn,$str,$this->value_));
}
functiondebug()
//딧桿鞫刻
{
echo$tempstr;
}
}
?>