惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
DataBreaches.Net
B
Blog
博客园_首页
C
Check Point Blog
Microsoft Security Blog
Microsoft Security Blog
MyScale Blog
MyScale Blog
P
Proofpoint News Feed
Engineering at Meta
Engineering at Meta
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
B
Blog RSS Feed
M
MIT News - Artificial intelligence
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
WordPress大学
WordPress大学
宝玉的分享
宝玉的分享
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
The Cloudflare Blog
量子位
V
V2EX
Y
Y Combinator Blog
Hugging Face - Blog
Hugging Face - Blog
Martin Fowler
Martin Fowler
Recent Announcements
Recent Announcements
I
InfoQ
博客园 - 【当耐特】

月光博客

AI编程从零开始:环境配置到开发调试-月光博客 母亲被保健品诈骗-月光博客 向身体低头,向岁月妥协:我的高血压“还债日记” -月光博客 月光博客电子书:《信息安全指南》 谷歌发布2025年度搜索排行榜 中国2025社会热点大事记 2025年十大流行语发布 7天3次,骗子骗走我母亲95万元 “技术男”设三重安全墙,母亲95万存款还是被骗走了 电信诈骗后的复盘:母亲的95万元,是怎么从手机银行里消失的 母亲被电信诈骗95万元的全过程 阿根廷警察被谷歌街景相机拍到裸照 网信办开展“清朗·整治恶意挑动负面情绪问题”专项行动 翟欣欣敲诈勒索案一审获刑12年 《绝命毒师》影评:力工觉醒后的梭哈至死 《人工智能生成合成内容标识办法》正式施行 用AI分析你的财务信息 腾讯子公司实习HR怒怼求职者后被开除 OpenAI发布最强模型GPT-5,免费向所有用户开放 用AI解构你的日记 用AI分析你的游戏偏好 用AI分析你的观影偏好 用AI分析你的听歌偏好 《白鹿原》人物分析:乱世浮沉中的人性剖析 乌托邦的捷径:让AI治理“失败国家” 苹果AI的“路径错误”:为什么它在大模型时代掉队了? 《暗黑破坏神3》第35赛季开荒指南 我对特朗普的看法 欧·亨利十大经典小说鉴赏 HBO电视剧《最后生还者》第二季影评
同时更新Twitter、饭否、嘀咕和做啥
月光 · 2009-06-15 · via 月光博客

很多微博客(如嘀咕和做啥)和第三方工具(如Hellotxt、Ping.fm)都同时提供了同步到其他微博客的服务,可以同步信息到一些主要的微博客服务,如Twitter、饭否等,但是这些工具都有一个很重要的问题,就是存在密码被盗或泄漏的风险。

目前大多数微博客是通过用户名和密码做为参数进行认证登录,Twitter可使用OAuth协议进行认证,而这些用户名和密码存放在这些同步工具网站上,万一保存不当,就有可能会被黑客获取,带来用户帐号被盗的风险,因此,比较保险的办法是通过自己写的程序来实现微博客的自动同步功能,这样被黑客破解的可能性就小了很多。

我这里写了一个同时更新Twitter、饭否、嘀咕和做啥等微博客的小程序,可以在自己的服务器上实现微博客同时更新功能,为了代码简单,使用时需要这几个服务使用相同的用户名和相同的密码,选中需要同步的微博客,也可勾选掉不想发布的服务,然后输入用户名和密码,发布信息后就会自动同时更新这几个微博客。

全部源程序代码如下:

<%@ CODEPAGE=65001 %>

<%
If Request("submit")<>"" Then

 Dim xmlhttp
 Set xmlhttp = Server.CreateObject("Microsoft.XMLHTTP")

 Response.Cookies("save_username")=Request("username")
 Response.Cookies("save_username").Expires=Date+365
 Response.Cookies("save_password")=Request("password")
 Response.Cookies("save_password").Expires=Date+365
 username = Request("username")
 password = Request("password")

 post_status = "status=" + server.URLencode(Request("updateStatus"))

 

If Request("Twitter") = 1 Then
  xmlhttp.Open "POST", "http://" & username & ":" & password & "@twitter.com/statuses/update.xml", False
  xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"
  xmlhttp.setRequestHeader "Content-Length", Len(post_status)
  xmlhttp.Send (post_status)
  Response.Write "twitter OK." 'xmlhttp.responseText
 End If

  If Request("fanfou") = 1 Then
  xmlhttp.Open "POST", "http://" & username & ":" & password & "@api.fanfou.com/statuses/update.xml", False
  xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"
  xmlhttp.setRequestHeader "Content-Length", Len(post_status)
  xmlhttp.Send (post_status)
  Response.Write "fanfou OK." 'xmlhttp.responseText
 End If

 If Request("digu") = 1 Then
  post_status = "content=" + server.URLencode(Request("updateStatus"))
  xmlhttp.Open "POST", "http://" & username & ":" & password & "@api.digu.com/statuses/update.xml", False
  xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"
  xmlhttp.setRequestHeader "Content-Length", Len(post_status)
  xmlhttp.Send (post_status)
  Response.Write "digu OK." 'xmlhttp.responseText
 End If

 If Request("zuosa") = 1 Then
  xmlhttp.Open "POST", "http://" & username & ":" & password & "@api.zuosa.com/statuses/update.xml", False
  xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"
  xmlhttp.setRequestHeader "Content-Length", Len(post_status)
  xmlhttp.Send (post_status)
  Response.Write "zuosa OK." 'xmlhttp.responseText
 End If

 Set xmlhttp = Nothing
 response.end
Else

%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html>
<head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
 <meta http-equiv="Content-Language" content="zh-CN" />
 <title>更新状态</title>
<script language="javascript"> 
function countChar(textareaName,spanName)

 document.getElementById(spanName).innerHTML = 140 - document.getElementById(textareaName).value.length;

</script>
</head>
<body>
 <form method="post" action="<%= Request.ServerVariables("URL")%>">
  <p>
   <textarea tabindex="1" id="updateStatus"  name="updateStatus" rows="6" cols="40" onkeydown='countChar("updateStatus","counter");' onkeyup='countChar("updateStatus","counter");'></textarea>
  </p>
  <p>
   <label><input tabindex="2" type="submit" id="submit" name="submit" value="  发     布  " /></label>可以输入 <span id="counter">140</span> 字
  </p>
  <p>
   <label>用户名:</label>
   <input tabindex="3" type="text" name="username" id="username" value="<%= Request.Cookies("save_username")%>" />
  </p>
  <p>
   <label>密 码:</label>
   <input tabindex="4" type="password" name="password" id="password" value="<%= Request.Cookies("save_password")%>" />
  </p>
  <p>
   <label><input type="checkbox" id="twitter" name="twitter" value="1" checked="checked"> Twitter </label><label><input type="checkbox" id="fanfou" name="fanfou" value="1" checked="checked"> 饭否 </label><label><input type="checkbox" id="digu" name="digu" value="1" checked="checked"> 嘀咕 </label><label><input type="checkbox" id="zuosa" name="zuosa" value="1" checked="checked"> 做啥</label>
  </p>
 </form>
</body>
</html>

<%
End if
%>
 

同时更新Twitter、饭否、嘀咕和做啥