//-----------------------------------------------------
	//SUB URLが404かどうかを判断する(1のとき、404)
	//-----------------------------------------------------
	function sub_sonota_url_chk($hp_ad) {
		
		$ret_value = 0;
		$head = get_http_header($hp_ad);
		$response = $head['Status-Code'];
#		if (
#		substr($response, 0, 1) != '1' &&
#		substr($response, 0, 1) != '2' &&
#		substr($response, 0, 1) != '3'
#		) 
		switch($response){
			case 'HTML':
				$ret_value = 0;
				break;
			default:
				//リンク切れ
				$ret_value = 1;
				break;
		}
#		echo "$hp_ad
";
#		echo "response,$response
";
		return $ret_value;
	}
	//-----------------------------------------------------
	//SUB URLがエラーかどうかを判断する(1のとき、エラー)
	//-----------------------------------------------------
	function sub_sonota_url_chk_test($hp_ad) {
		
		$ret_value = 0;
		$head = get_http_header($hp_ad);
		$response = $head['Status-Code'];
#		if (
#		substr($response, 0, 1) != '1' &&
#		substr($response, 0, 1) != '2' &&
#		substr($response, 0, 1) != '3'
#		) 
		switch($response){
#			case '400':
#			case '401':
#			case '403':
			case '404':
			case '420':
			case '421':
			case '500':
			case '503':
				//リンク切れ
				$ret_value = 1;
				break;
			default:
				$ret_value = 0;
		}
#		echo "$hp_ad
";
#		echo "response,$response
";
		return $ret_value;
	}
	//-----------------------------------------------------
	//SUB URLからヘッダーを取得
	//-----------------------------------------------------
	function get_http_header( $target ) {
		// URIから各情報を取得
		$info = parse_url( $target );
		$scheme = $info['scheme'];
		$host = $info['host'];
		$port = $info['port'];
		$path = $info['path'];
		// ポートが空の時はデフォルトの80にします。
		if( ! $port ) {
			$port = 80;
		}
		// リクエストフィールドを制作。
		$msg_req = "HEAD " . $path . " HTTP/1.0\r\n";
		$msg_req .= "Host: $host\r\n";
		$msg_req .=
			"User-Agent: H2C/1.0\r\n";
		$msg_req .= "\r\n";
		// スキームがHTTPの時のみ実行
		if ( $scheme == 'http' ) {
			$status = array();
			// 指定ホストに接続。
			if ( $handle = @fsockopen( $host, $port, $errno, $errstr, 1 ) ) {
				fputs ( $handle, $msg_req );
				if ( socket_set_timeout( $handle, 3 ) ) { 
					$line = 0;
					while( ! feof( $handle) ) {
						// 1行めはステータスライン
						if( $line == 0 ) {
							$temp_stat =
								explode( ' ', fgets( $handle, 4096 ) );
							$status['HTTP-Version'] =
								array_shift( $temp_stat );
							$status['Status-Code'] = array_shift( $temp_stat );
							$status['Reason-Phrase'] =
								implode( ' ', $temp_stat );
						// 2行目以降はコロンで分割してそれぞれ代入
						} else {
							$temp_stat =
								explode( ':', fgets( $handle, 4096 ) );
							$name = array_shift( $temp_stat );
							// 通常:の後に1文字半角スペースがあるので除去
							$status[ $name ] =
								substr( implode( ':', $temp_stat ), 1);
						}
						$line++;
					}
				} else {
						$status['HTTP-Version'] = '---';
						$status['Status-Code'] = '902';
						$status['Reason-Phrase'] = "No Response";
				}
				fclose ( $handle );
			} else {
				$status['HTTP-Version'] = '---';
				$status['Status-Code'] = '901';
				$status['Reason-Phrase'] = "Unable To Connect";
			}
		} else {
			$status['HTTP-Version'] = '---';
			$status['Status-Code'] = '903';
			$status['Reason-Phrase'] = "Not HTTP Request";
		}
		return $status;
	}
?>
ヨグマタ 相川圭子(よぐまた あいかわ けいこ)

女性として史上初のシッダーマスター(サマディヨギ/ヒマラヤ大聖者の意)であり、現在、会うことのできる世界でたった二人のシッダーマスターのひとり。
主な著書に『死を見つめるたった1つの方法』、(KADOKAWA)、『奇跡はいつも起きている』(大和出版)、『宇宙に結ぶ「愛」と「叡智」』(講談社)、『The Road to Enlightenment: Finding the Way Through Yoga Teachings and Meditation』(講談社USA)など。他にNHK・CDセレクション『ラジオ深夜便 ヨガと瞑想の極致を求めて』などがある。