<%@ 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的,或者谁有现成的同步代码

解决方案 »

  1.   

    xmlhttp是Ajax 中的内容,怎么变成ASP中的呢
      

  2.   

    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);
      }
    }