我正在阅读https://developer.yammer.com/opengraph/。并尝试创建我的应用程序。我试图在php上做一个简单的opengraph请求O得到了这个错误({"errors":["Missing required param \"activity\""]})
。
这是我的代码
<?php
$data_string='{
"activity":{
"actor":{"name":"Sidd Singh",
"email":"adriantest@protonmail.ch},
"action":"created",
"object": {
"url":"https://www.sched.do",
"title":"Lunch Meeting"
}
}
}';
$access_token = '4Mheyevf4FmzRPtwNUviOQ';
$ch = curl_init('https://www.yammer.com/api/v1/activity.json');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($data_string),
"Authorization: Bearer $access_token"
)
);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
//execute post
$result = curl_exec($ch);
//close connection
curl_close($ch);
echo $result;
?>