扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
<link href="css/layout.css" rel="stylesheet" type="text/css" /> <script src="js/request.js"></script> |
<body onload="javascript:makeRequest('request.php?request=' + document.feedForm.feed.value + '"password=mypassword');"> <form name="feedForm" method="post" action="javascript:makeRequest('request.php?request=' + document.feedForm.feed.value + '"password=mypassword');"> Enter a feed: <input type="text" name="feed" id="feed" size="20"> <input type="submit" name="submit" value="Add Feed"> </form> <div id="logo"></div> <hr/> <div id="copy"></div> <div id="details"></div> </body> |
//如果不存在目录就创建一个 $dir = "rss"; if(!is_dir($dir)) { mkdir($dir, 0666); } |
//创建唯一的命名 $file=md5($rss_url); $path="$dir/$file.xml"; |
//复制馈送到本地服务器 copy($rss_url,"$path"); return $path; Following is the small, yet powerful RSS class in its entirety: <?php class RSS { function get($rss_url) { if($rss_url != "") { //如果不存在目录就创建一个 $dir = "rss"; if(!is_dir($dir)) { mkdir($dir, 0666); } // 创建一个唯一的名字 $file = md5($rss_url); $path = "$dir/$file.xml"; //复制馈送到本地服务器 copy($rss_url, "$path"); return $path; } } } ?> |
<? if($password == "mypassword") { require_once('classes/RSS.class.php'); $rss = new RSS(); echo $rss->get($request); } else { echo "You are an unauthorized user"; } ?> |
function sendFeed(url){ post.onreadystatechange = sendRequest; post.open("POST", url, true); post.send(url); } |
function sendRequest(){ if(checkReadyState(post)){ request = createRequestObject(); request.onreadystatechange = onResponse; request.open("GET", post.responseText, true); request.send(null); } } |
var _logo = ""; var _title = response.getElementsByTagName('title')[0].firstChild.data; var _link = response.getElementsByTagName('link')[0].firstChild.data;; _logo += "<a href='" + _link + "' target='_blank'>" + _title + "</a><br/>"; if(checkForTag(response.getElementsByTagName('image')[0])) { var _url = response.getElementsByTagName('url')[0].firstChild.data; _logo += "<img src='" + _url + "' border='0'><br/>" } document.getElementById('logo').innerHTML = _logo; |
if(checkForTag(response.getElementsByTagName('image')[0]) "" i>0){ var _title=response.getElementsByTagName('title')[i+1].firstChild.data; var _link=response.getElementsByTagName('link')[i+1].firstChild.data; } else{ var _title =response.getElementsByTagName('title')[i].firstChild.data; var _link = response.getElementsByTagName('link')[i].firstChild.data; } |
function checkForTag(tag){ if(tag != undefined) { return true; } else{ return false; } } |
if(i>1){ var previousPubDate = response.getElementsByTagName('pubDate')[i-1].firstChild.data; } if(pubDate != previousPubDate || previousPubDate == undefined){ _copy += "<div id='detail'>" + pubDate + "</div><hr align='left' width='90%'/>"; } _copy += "<a href=\"javascript:showDetails('" + i + "');\">" + _title + "</a><br/><br/>"; document.getElementById('copy').innerHTML += _copy; |
function showDetails(index){ document.getElementById('details').innerHTML = response.getElementsByTagName('description')[index].firstChild.data; } |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者