$resultAry1 = json_decode($result,true);	


$result = HU_getRequest(API_URL . "/userMessages/{$user1Id}/30/0",array(
	'token' => $token2
));

$result = HU_getRequest(API_URL . "/activitySummary",array(
	'token' => $token2,
));

$resultAry2 = json_decode($result,true);	

print_r($resultAry1);
print_r($resultAry2);
die();
*/
$result = HU_postRequest(API_URL . "/sendMessageToGroup", json_encode(array("to_group_id" => $newGroupId, "body" => "Hi")), array('token' => $token1));
$result = HU_postRequest(API_URL . "/sendMessageToGroup", json_encode(array("to_group_id" => $newGroupId, "body" => "Hi")), array('token' => $token1));
$resultAry = json_decode($result, true);
if (empty($resultAry['id'])) {
    die("send group message failed {$result}");
}
$newMessageId = $resultAry['id'];
$result = HU_getRequest(API_URL . "/activitySummary", array('token' => $token2));
$resultAry1 = json_decode($result, true);
$result = HU_getRequest(API_URL . "/groupMessages/{$newGroupId}/30/0", array('token' => $token2));
$result = HU_getRequest(API_URL . "/activitySummary", array('token' => $token2));
$resultAry2 = json_decode($result, true);
print_r($resultAry1);
print_r($resultAry2);
Пример #2
0
    die("send comment failed {$result}");
}
print "send comment : OK {$resultAry['id']}\n";
//////// comment count
$result = HU_postRequest(API_URL . "/sendComment", json_encode(array("message_id" => $newMessageId, "comment" => "Hi1")), array('token' => $token));
$result = HU_postRequest(API_URL . "/sendComment", json_encode(array("message_id" => $newMessageId, "comment" => "Hi2")), array('token' => $token));
$result = HU_postRequest(API_URL . "/sendComment", json_encode(array("message_id" => $newMessageId, "comment" => "Hi3")), array('token' => $token));
$result = HU_getRequest(API_URL . "/commentsCount/{$newMessageId}", array('token' => $token));
$resultAry = json_decode($result, true);
$targetUserId = $resultAry['id'];
if (empty($resultAry['rows'][0]['value'])) {
    die("count comment failed {$result}");
}
print "count comment : OK {$resultAry['rows'][0]['value']}\n";
//////// get comments
$result = HU_getRequest(API_URL . "/comments/{$newMessageId}/30/0", array('token' => $token));
$resultAry = json_decode($result, true);
if (empty($resultAry['rows'][0])) {
    die("read comment failed {$result}");
}
print "read comment : OK\n";
//////// watch group test
$result = HU_postRequest(API_URL . "/watchGroup", json_encode(array("group_id" => $newGroupId)), array('token' => $token));
if ($result != 'OK') {
    die("watch group failed {$result}");
}
print "watch group : OK \n";
//////// unwatch group test
$result = HU_postRequest(API_URL . "/unWatchGroup", json_encode(array("group_id" => $newGroupId)), array('token' => $token));
if ($result != 'OK') {
    die("unwatch group failed {$result}");