<?php
require_once("function.php");
$url="http://www.linkshare.ne.jp/index.xml";
//echo $url;
$xml=simplexml_load_file($url);
$hits=$xml->channel->item;
?>
<html>
<head>
<meta charset="UTF-8">
<title>リンクシェアサイトの新着情報 RSS表示</title>
</head>
<body>
<p>リンクシェアサイトの新着情報一覧</p>
<ul>
<?php foreach ($hits as $hit) { ?>
<li><a href="<?php echo h($hit->link); ?>"><?php echo h($hit->title); ?></a></li>
<?php } ?>
</ul>
</body>
</html>
<?php
require_once("config.php");
require_once("function1.php");
$keyword="siri";
$keywordurl=urlencode($keyword);
$url="http://chiebukuro.yahooapis.jp/Chiebukuro/V1/questionSearch?appid=$yahooappid&query=$keywordurl&condition=solved";
$xml=simplexml_load_file($url);
$hits=$xml->Result->Question;
?>
<html>
<head>
<meta charset="UTF-8">
<title><?php echo h($keyword); ?>のQ&A検索結果</title>
<style>
#container {
width: 760px;
margin: 20px auto;
background-color: #CCC;
}
p.question {
color: #F00;
}
p.question, p.answer {
font-size: 0.875em;
margin-left: 1.0em;
text-indent: -1.0em;
}
</style>
</head>
<body>
<div id="container">
<h1>「<?php echo h($keyword); ?>」のQ&A検索結果</h1>
<?php foreach ($hits as $hit) { ?>
<p class="question">Q.<?php echo h($hit->Content); ?></p>
<p class="answer">A.<?php echo h($hit->BestAnswer); ?>
<a href="<?php echo h($hit->Url); ?>">詳細</a>
</p>
<?php } ?>
</div>
</body>
</html>
<?php
$cacheOptions = array (
'cacheDir' => './cache/',
'lifeTime' => '3600',
'automaticCleaningFactor' => 200
);
$yahooappid = "NiZK69qxg65ddm1MrWEpwFw1hAdbox4rf6HHqsJav.7VIKHXqySdGzuuNaUpR.CP4csRpWQdXB1x53cYr2Qe6niNgA--";
?>?>
<?php
function h($str)
{
$str=htmlspecialchars($str,ENT_QUOTES);
$str=str_replace("&lt;!--","<!--",$str);
$str=str_replace("--&gt;","-->",$str);
return $str;
}
?>