検索
ホームページphp教程php手册データ収集クラス

データ収集クラス

Jun 13, 2016 pm 12:34 PM
linuxコード著者互換性があるコピーデータ収集プログラム親切

コードをコピー コードは次のとおりです:


// php4 php5 と互換性があります
// プログラム作成者 Zhang Jian 52linux.com (Linux が大好きです)
// 連絡先 733905@qq.com QQ 733905
// 単純な呼び出しメソッド
/*

include ("ugs.php") // この ugs.phps をダウンロードして、名前を ugs.php
$ に変更できます。 ugs = new ugs();
$url = "http://domainname.com/path_to_your_target?param";
$ugs->seturl($url); ( );
//......ここで、このクラスの他のメソッドを呼び出して、$ugs->value_、
要件を満たすように
$content=$ugs-> を調整できます。 getcontent();
print($content);
*/
class ugs
{
var $value_ ; src_ ; //'ターゲット URL アドレス

function seturl($url)
{
$this->src_=$url;
function getcontent()
{
return $this->value_;
}
function getfile($url)
// ターゲットを取得
{
$url_parsed = parse_url($url); 🎜> $host = $url_parsed["host"];
$port = $url_parsed["port"];
if ($port==0) $port = 80 ; url_parsed["path"];
if (empty($path))
$path="/";
if ($url_parsed["query"] != "")
$path .= "?".$url_parsed["query"];
$out = "GET $path HTTP/1.0rnHost: $hostrnrn";
$fp = fsockopen($ host, $port, $errno, $errstr, 30);
fwrite($fp, $out);
$body = false;
{
$s = fgets( $fp, 1024);
if ( $body ) $in .= $s;
if ( $s == "rn" )
$ body = true;
ローカル/bin/curl " ; // Curl へのパス
$curl_options=" -s --connect-timeout 10 --max-time 10 ";
// Curl の使用法については、curl を参照してください -- help または mancurl
//curl には非常に豊富なパラメータがあり、さまざまなブラウザ (エージェント) をシミュレートでき、リファラーを設定できます
$cmd="$curl $curl_options $url ";
@exec($cmd) ,$ o,$r);
if($r!=0)
{
return "タイムアウト"
}
else
{
$o=join (" ",$o);
$o を返します
}
}

function gather_curl($curl)
{
$http=$this->getfile_curl($this->src_);
return $this->value_=$http;
}

function gather_array($url)
{
return file($url);
}

function gather()
// 开始收集
{
$http=$this->getfile($this->src_);
return $this->value_=$http;
}

function gather_local($toline=true)
// 处理本地文件
{

if($toline)

$http =file($this->src_);
return $this->value_=$this->BytesToBstr($http);
}
else
{
$http=file($this->src_);
return $this->value_=$http;
}



}

function noReturn()
// 删除回车换行

$this-> ;値_= str_replace("n","",$this->value_);
$this->value_=str_replace("r","",$this->value_);
}


function change($oldStr,$str)
//'对収集された内容中の个别字符串用新值変更/メソッド
//'パラメータ分别は旧文字列,新文字列
{
$this->value_=str_replace($oldStr,$str,$this->value_ );
}



function Cut($start,$end,$no='1',$comprise='')
//'指定された first および最後の文字列を切り取る (最初と最後の文字列を除く) メソッド
// $no は 1,2 3... 0 は許可されません
// $comprise は開始、終了、すべてを選択するか、何も入力しないことができます
{
$string=explode($start,$this->value_);
//print_r($string)
$string=explode($end,$string[$no] ) ;
//print_r($string);
'start':
$string=$start.$string[0]; > $end;
ブレーク;
デフォルト:
$string=$string[0];
return $this->value_=$string;


function filt($head,$bot,$str,$no='1',$comprise='')
//' 収集されたコンテンツに、指定された最初と最後の文字列 置換 (最初と最後の文字列を除く) メソッド
// 'パラメータは最初の文字列、最後の文字列、および新しい値です。新しい値が空の場合、フィルタリングされます
{
$tmp_v=$this-> ;value_
$tmp=$this->cut($head,$bot,$no,$comprise); ); 🎜> }



function local()
{
/ まだ実装されていません
}



function replaceByReg($patrn,$str)
//' 収集されたコンテンツ内の正規表現に一致する新しい文字列を使用します。値の置換/メソッド
//' パラメーターはカスタム正規表現、新しい値です。
{
return $this->> value_=join("",preg_replace($patrn,$str ,$this->value_));
}



function debug()
//デバッグdisplay
{
$tempstr="function runEx(){var winEx2 = window.open("", "winEx2", "width=500,height=300,status=yes,menubar= no,scrollbars=yes,resizable=yes"); winEx2.document.open("text/html", "replace"); winEx2.document.write(unescape(event.srcElement.parentElement.children[0].value) ); winEx2.document.close(); }関数 saveFile( ){var win=window.open('','','top=10000,left=10000');win.document.write(document.all. asdf.innerText);win.document.execCommand('名前を付けて保存' ,'','javascript.htm');win.close();}



      
";
echo $tempstr;
}


}
?>

声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。

ホットAIツール

Undresser.AI Undress

Undresser.AI Undress

リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover

AI Clothes Remover

写真から衣服を削除するオンライン AI ツール。

Undress AI Tool

Undress AI Tool

脱衣画像を無料で

Clothoff.io

Clothoff.io

AI衣類リムーバー

Video Face Swap

Video Face Swap

完全無料の AI 顔交換ツールを使用して、あらゆるビデオの顔を簡単に交換できます。

ホットツール

PhpStorm Mac バージョン

PhpStorm Mac バージョン

最新(2018.2.1)のプロフェッショナル向けPHP統合開発ツール

AtomエディタMac版ダウンロード

AtomエディタMac版ダウンロード

最も人気のあるオープンソースエディター

WebStorm Mac版

WebStorm Mac版

便利なJavaScript開発ツール

SecLists

SecLists

SecLists は、セキュリティ テスターの究極の相棒です。これは、セキュリティ評価中に頻繁に使用されるさまざまな種類のリストを 1 か所にまとめたものです。 SecLists は、セキュリティ テスターが必要とする可能性のあるすべてのリストを便利に提供することで、セキュリティ テストをより効率的かつ生産的にするのに役立ちます。リストの種類には、ユーザー名、パスワード、URL、ファジング ペイロード、機密データ パターン、Web シェルなどが含まれます。テスターはこのリポジトリを新しいテスト マシンにプルするだけで、必要なあらゆる種類のリストにアクセスできるようになります。

EditPlus 中国語クラック版

EditPlus 中国語クラック版

サイズが小さく、構文の強調表示、コード プロンプト機能はサポートされていません