ユーザ用ツール

サイト用ツール

Writing /var/www/vhosts/w629.ws.domainking.cloud/enjoy-lei.com/lei_wiki/data/cache/9/976f83916040d8a1b622c0e997b49291.i failed
Unable to save cache file. Hint: disk full; file permissions; safe_mode setting.
Writing /var/www/vhosts/w629.ws.domainking.cloud/enjoy-lei.com/lei_wiki/data/cache/9/976f83916040d8a1b622c0e997b49291.metadata failed

サイトのurl検索
Writing /var/www/vhosts/w629.ws.domainking.cloud/enjoy-lei.com/lei_wiki/data/cache/9/976f83916040d8a1b622c0e997b49291.i failed
Unable to save cache file. Hint: disk full; file permissions; safe_mode setting.
Writing /var/www/vhosts/w629.ws.domainking.cloud/enjoy-lei.com/lei_wiki/data/cache/9/976f83916040d8a1b622c0e997b49291.xhtml failed

サイトのurl検索

    <?php
  #ページのURLをチャック
  
  $TopUrl = "http://www.enjoy-lei.com";
  	if($deta = wget($TopUrl,"EUC-JP")){
  
  		$reg = '/(\'|\")(http|https):\/\/[-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+(\'|\")/';
  		if(preg_match_all($reg,$deta,$d)){
  			$TopUrlArray = $d[0];
  		}
  print_r($TopUrlArray);
  exit();
  		//データを整理する
  		if(is_array($TopUrlArray)){
  			$newUrlArray = array();
  			foreach($TopUrlArray as $key => $value){
  				if(preg_match_all('/\"/',$value,$d)){
  					$newUrlArray[$key] = preg_replace("/\"/","",trim($value));
  					$newUrlArray[$key] = preg_replace("/\'/","",trim($newUrlArray[$key]));
  				}
  			}
  		}
  
  		//重複削除
  		if(is_array($newUrlArray)){
  			$newUrlArray = array_unique($newUrlArray);
  		}
  
  	}
  	

  	//ここでチャックする
  	if(count($newUrlArray) > 0){
  		$ngArray = array();
  		foreach($newUrlArray as $key => $value){
  			if($deta = url_exists($value)){
  				$ngArray[$value] = $deta;
  			}
  			/*
  			if(!$deta = url_exists($value)){
  				$ngArray[$value] = "ng";
  			}
  			*/
  		}
  	}
  	//print_r($ngArray);
  	

  	//ここでURLを存在するかどうかのチェック
  	function url_exists($url) {
  		if(checkUrl($url)){
  			$header = get_headers($url);
  			if(strstr($header[0], '200')){
  				 return true;
  			}
  		}
  	  return false;
  	}

  	//URLが正しいかどうかをチェック
  	function checkUrl($url){
  
  		if (preg_match('/^(https?|ftp)(:\/\/[-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)$/', $url)) {
  		   return true;
  		} else {
  		    return false;
  		}
  		
  	}
  	

  	//URLからデータを収得
  	function wget($url,$code="UTF-8"){
  		$line = file_get_contents($url);
  		$line = mb_convert_encoding($line,'Shift-JIS', $code);
  		$line = preg_replace('/(\n|\t|&nbsp;|\r|\r\n)/',' ',$line);
  		$line = preg_replace('/\s+/',' ',$line);
  		return $line;
  	}
  


  ?>
サイトのurl検索.txt · 最終更新: 2014/03/16 22:31 by luis_lee