Skip to content

Instantly share code, notes, and snippets.

@nguyenphucbao68
Last active April 1, 2017 11:00
Show Gist options
  • Save nguyenphucbao68/ebfc4ce9597ace6801885875abe7b732 to your computer and use it in GitHub Desktop.
Save nguyenphucbao68/ebfc4ce9597ace6801885875abe7b732 to your computer and use it in GitHub Desktop.
Get List Reactions Facebook
; #FUNCTION# ====================================================================================================================
; Name ..........: _GetReactions
; Description ...: Lấy user like từ ID Post
; Syntax ........: _GetReactions(ByRef $link)
; Parameters ....: ByRef $link - Link.
; Return values .: Success : Trả về sớ lượng Reactions bài viết và Danh Sách User Reactions Bài viết
; Failure : @error set về 0
; Author ........: Trojan Nguyen
; ===============================================================================================================================
Func _GetReactions(ByRef $link)
If $link="" then Return SetError(1,0,False)
$JsonObj = Json_Decode(_INetGetSource($link))
$i = 0
While 1
$id = Json_Get($JsonObj, '["data"][' & $i & ']["id"]')
If @error then ExitLoop
$name = Json_Get($JsonObj, '["data"][' & $i & ']["name"]')
If @error then ExitLoop
Json_Put($Array, "."&$id&"[id]", $id)
Json_Put($Array, "."&$id&"[name]", $name)
$i += 1
Wend
$next = Json_Get($JsonObj, '["paging"]["next"]')
If @error Then Return $i-1
If $next<>"" and not @error Then
_GetReactions($next); Gọi đệ quy
EndIf
Return $i-1
EndFunc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment