ホスト(ドメイン)からハッシュを作成する

ソースコード

	$url=$_SERVER['HTTP_REFERER'];//遷移元URLを取得
	$url_host=parse_url($url,PHP_URL_HOST);//ホストを抜き出す。
	$hash = hash('sha256',MD5($url_host));
	
	echo 'URL = '.$url.'<br>';
	echo 'HOST = '.$url_host.'<br>';
	echo 'HASH = '.$hash.'<br>';

URL = http://amaraimusi.sakura.ne.jp/sample/php/hash/host_to_hash.php
HOST = amaraimusi.sakura.ne.jp
HASH = 0cf96c2702ef8e3a1c2369387363f52c78d957875c80ddd305c954ce57192081

(c)wacgance 2015-06-12