这段asp怎么写成php的

cxycxycxyc 2009-07-24 04:00:56
<%@ 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的,或者谁有现成的同步代码
...全文
131 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
程序猿之殇 2009-07-24
  • 打赏
  • 举报
回复
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:%s@twitter.com/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);
}
}
eimhee 2009-07-24
  • 打赏
  • 举报
回复
xmlhttp是Ajax 中的内容,怎么变成ASP中的呢

21,893

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧