Php 如何使用用户用户名和密码使用twitter API更新状态?

Php 如何使用用户用户名和密码使用twitter API更新状态?,php,curl,twitter,Php,Curl,Twitter,我有一个小应用程序,可以直接从我的网站上更新twitter用户的状态 网站! 我希望我的网站的每个登录用户都能够通过提供用户名和密码来更新他们的twitter状态 我搜索了很多,但没有发现更新和有用的东西 function update_status($username, $password, $message) { $ch = curl_init($this->update_url); curl_setopt($ch, CURLOPT_POST, 1); cur

我有一个小应用程序,可以直接从我的网站上更新twitter用户的状态 网站! 我希望我的网站的每个登录用户都能够通过提供用户名和密码来更新他们的twitter状态

我搜索了很多,但没有发现更新和有用的东西

function update_status($username, $password, $message)
{
    $ch = curl_init($this->update_url);

    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, 'status='.urlencode($message));
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_USERPWD, $username . ':' . $password);

    curl_exec($ch);

    $httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);

    // if we were successfull we need to update our last_message
    if ($httpcode == '200')
    {
        $this->db->where('active', '1');
        $this->db->update($this->accounts_table, array('last_message' => $message));

        return TRUE;    
    }

    else
    {
        return FALSE;   
    }
}

推特推特,你不想在网站上处理Twitter用户名和密码,因为安全原因,正确的方法是允许用户通过推特进行认证,并提供给你使用他们的帐户所需的密钥。试着推特推特,使用你的Twitter SDK,你不想在网站上处理Twitter用户名和密码,因为安全原因,正确的方法是允许用户通过推特认证,并提供你使用他们的帐户所需的密钥。尝试