<%@ CODEPAGE=936 %> <%
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=gb2312"
xmlhttp.setRequestHeader "Content-Length", Len(post_status)
xmlhttp.Send (post_status)
Response.Write "twitter OK." 'xmlhttp.responseText
End If
是同步twitter的代码,怎么写成php的,或者谁有现成的同步代码
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=gb2312"
xmlhttp.setRequestHeader "Content-Length", Len(post_status)
xmlhttp.Send (post_status)
Response.Write "twitter OK." 'xmlhttp.responseText
End If
是同步twitter的代码,怎么写成php的,或者谁有现成的同步代码
{
set_cookie("save_username", $_POST['username'], time()+365);
set_cookie("save_password", $_POST['password'], time()+365);
$username = $_POST["username"];
$password = $_POST["password"];
$status = "status=" . urlencode($_POST['updateStatus']);
if($_POST['twitter'] == 1)
{
$ch = curl_init();
//设置URL,POST方式提交以及POST数据
curl_setopt($ch, CURLOPT_URL, $searchURL);
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_URL, sprintf("http://%s:%[email protected]/statuses/update.xml", $username, $password));
curl_setopt($ch, CURLOPT_POSTFIELDS, sprintf("status=%s", $status));
$header = array('Accept: application/x-www-form-urlencoded; charset=gb2312');
curl_setopt($ch,CURLOPT_HTTPHEADER,$header);
$result = curl_exec($ch);
}
}
if($_POST['submit'] <> "")
{
//set_cookie("save_username", $_POST['username'], time()+365);
//set_cookie("save_password", $_POST['password'], time()+365);
$username = $_POST["username"];
$password = $_POST["password"];
$status = "status=" . urlencode($_POST['updateStatus']);
if($_POST['twitter'] == 1)
{
$ch = curl_init();
//设置URL,POST方式提交以及POST数据
curl_setopt($ch, CURLOPT_URL, $searchURL);
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_URL, sprintf("http://%s:%[email protected]/statuses/update.xml", $username, $password));
curl_setopt($ch, CURLOPT_POSTFIELDS, sprintf("status=%s", $status));
$header = array('Accept: application/x-www-form-urlencoded; charset=gb2312');
curl_setopt($ch,CURLOPT_HTTPHEADER,$header);
$result = curl_exec($ch);
}
if($_POST['zuosa'] == 1)
{
$ch = curl_init();
//设置URL,POST方式提交以及POST数据
curl_setopt($ch, CURLOPT_URL, $searchURL);
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_URL, sprintf("http://%s:%[email protected]/statuses/update.xml", $username, $password));
curl_setopt($ch, CURLOPT_POSTFIELDS, sprintf("status=%s", $status));
$header = array('Accept: application/x-www-form-urlencoded; charset=gb2312');
curl_setopt($ch,CURLOPT_HTTPHEADER,$header);
$result = curl_exec($ch);
}
exit();}
else
{
}?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-CN" lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"/>
<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="<? echo $_SERVER["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="<? echo $_COOKIE["save_username"];?>" />
</p>
<p>
<label>密 码:</label>
<input tabindex="4" type="password" name="password" id="password" value="<? echo $_COOKIE["save_password"];?>" />
</p>
<p>
<label><input type="checkbox" id="twitter" name="twitter" value="1" checked="checked"> Twitter </label><label><input type="checkbox" id="zuosa" name="zuosa" value="1" checked="checked"> 做啥</label>
</p>
</form>
</body>
</html>这是根据jakey9826写的code改的,但返回数据不对。twitter的测试不了 ,zuosa.com的可以测试,还是不能发布信息
以zuosa.com,至少登录用户才能发帖吧,所以需要伪造refer,header,user_agent等.
以zuosa.com,至少登录用户才能发帖吧,所以需要伪造refer,header,user_agent等.