2017-05-23 1 views
0

Ich möchte eine einfach skype bietet über php für send to bild und Massage im müde für serch recive aberwie man eine skype-skype über php verbindet und sendet massage?

im nach brauchen Hilfe-Token jede wahre sdk oder complated Probe für diesen von https://login.microsoftonline.com/botframework.com/oauth2/v2.0/token

jetzt nicht finden kann, Ich habe meine Token und Sed in Echtzeit und schicke dies immer mit meinen Anfragen.

aber ich bin nicht undrrestand und gut, was ist ein Weg für Send Massage? Was sind Massageparameter? was ist senden massage post link?

Ich habe diesen Fehler: Die Seite kann nicht angezeigt werden, weil ein interner Serverfehler aufgetreten ist.

pls helfe mir und sende fertig oder wahre sdk zur arbeit!

im avry sdk in git rtying oder Google nicht meine Antwort finden ..

Dank.

Antwort

0

Hallo das ist mein Bot-Skript, mit diesem kann ich Token bekommen und Realtim senden nur ich weiß nicht, was ist der nächste Schritt für senden msg oder was ist mein Skript Problem?

i useing php lagn

$content = file_get_contents("php://input"); 
$update = json_decode($content,true); 
$conversation=$update['conversation']['id']; 
$user=$update['from']['id']; 
file_put_contents('skype.txt',print_r($update,true)); 

$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL,"https://login.microsoftonline.com/botframework.com/oauth2/v2.0/token"); 
curl_setopt($ch, CURLOPT_POST, 1); 

$params ="grant_type=client_credentials&"; 
$params.="client_id=*****************************"; // My id 
$params.="client_secret=**************************"; // My Password 
$params.="scope=https://api.botframework.com/.default"; 

curl_setopt($ch, CURLOPT_POSTFIELDS,$params); //Post Fields 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
$headers = array(); 
$headers = ['Content-Type: application/x-www-form-urlencoded']; 
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); 
$result = curl_exec ($ch); 
if(curl_errno($ch)){ 
    var_dump(curl_error($ch)); 
} 

$result=json_decode($result); 
$access_token=$result->access_token; // now i have access token 


// what is after this step ? for send or reply msg in skype bot ? 
// send request for send massage ?! 
curl_setopt($ch, CURLOPT_URL,"https://skype.botframework.com/v3/conversations/".$conversation."/activities/".$user); 
curl_setopt($ch, CURLOPT_POST, 1); 
// what is parametr for send or reply msg ? 
// what is requarement params ? 
$params=array(
    'type' =>'message' , 
    'timestamp'=>$update['timestamp'], 
    'from'=>array(
     'id' => $update['from']['id'], 
     'name' => $update['from']['name'], 
     ), 
    'conversation'=>array(
     'id' => $update['conversation']['id'], 
     ), 
    'recipient'=>array(
    'id' => $update['recipient']['id'], 
    'name' => $update['recipient']['name'], 
    ), 
    'text'=>'Wellcome to MWH', 
    'replyToId' =>$user, 
); 

$params=json_encode($params); 
curl_setopt($ch, CURLOPT_POSTFIELDS,$params); //Post Fields 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
$headers = array(); 
$headers = ['Authorization: Bearer'.$access_token]; 
$headers = ['Content-Type: application/json; charset=utf-8']; 
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); 
$res = curl_exec ($ch); 
if(curl_errno($ch)){ 
    var_dump(curl_error($ch)); 
} 
curl_close ($ch); 
$res=json_decode($res); 

// file_put_contents('skype.txt',print_r($res,true)); 

im verwenden Sie diesen Link https://blogs.msdn.microsoft.com/tsmatsuz/2016/08/19/build-skype-bot-with-microsoft-bot-framework-oauth-and-rest-api/

Verwandte Themen