2009-12-07 7 views
0

트위터 응용 프로그램을 만들려고합니다. 트위터의 사용자 인증 시스템을 통해 사용자가 로그인하는 시점까지 신청했습니다. 내 응용 프로그램을 사용하여 상태 업데이트를 보낼 수도 있습니다. 나는 상태 업데이트를 보내려면이 기능을 가지고 :OAuth를 사용하여 직접 메시지를 보내는 방법은 무엇입니까?

function sendTweet($tx){ 

    $consumer_key = 'MY CONSUMER KEY'; 
    $consumer_secret = 'MY CONSUMER SECRET'; 

    $Twitter = new EpiTwitter($consumer_key, $consumer_secret); 
    $Twitter->setToken($_SESSION['OT'],$_SESSION['OTS']); 

    $text=$tx; 
    $status=$Twitter->post_statusesUpdate(array('status' => $text)); 
    $status->response; 

} 

sendTweet($tx) 기능은 마치 마법처럼 작동하지만 지금 내가 뭘해야 사용자의 추종자의 목록을 다음 그들에게 직접 메시지를 보낼 수 있습니다. oauth와 PHP를 사용하여 어떻게 할 수 있습니까?

답변

0
function sendDirectMessage($user,$message) 
{  $consumer_key = 'YOUR CONSUMER KEY'; 
     $consumer_secret = 'YOUR SECRET'; 

     $Twitter = new EpiTwitter($consumer_key, $consumer_secret); 
     $Twitter->setToken($_SESSION['OT'],$_SESSION['OTS']); 

     $myArray = array('user' => $user, 'text' => $message); 

     $resp = $Twitter->post_direct_messagesNew($myArray); 
     $resp->response; 
    } 
+0

이 기능을 사용하여 사람들이 쉽게 따라 할 수 있다고 설명 할 수 있습니까? –

관련 문제