Skip to content

Instantly share code, notes, and snippets.

@nguyenphucbao68
Created April 1, 2017 11:00
Show Gist options
  • Save nguyenphucbao68/341bcd5adf91accb0d0f52ca2b5ad09f to your computer and use it in GitHub Desktop.
Save nguyenphucbao68/341bcd5adf91accb0d0f52ca2b5ad09f to your computer and use it in GitHub Desktop.
GetListComment Facebook
; #FUNCTION# ====================================================================================================================
; Name ..........: _GetCMT
; Description ...: Lấy comment từ ID Post
; Syntax ........: _GetCMT(ByRef $link)
; Parameters ....: ByRef $link - Link.
; Return values .: Success : Trả về danh sach ID user bình luận
; Failure : @error set về 0
; Author ........: Trojan Nguyen
; ===============================================================================================================================
Func _GetCMT(ByRef $link)
If $link="" then Return SetError(1,0,False)
$JsonObj = Json_Decode(_INetGetSource($link))
$i = 0
While 1
$id = Json_Get($JsonObj, '["comments"]["data"][' & $i & ']["from"]["id"]')
If @error then ExitLoop
$name = Json_Get($JsonObj, '["comments"]["data"][' & $i & ']["from"]["name"]')
If @error then ExitLoop
Json_Put($ArrayCMT, "."&$id&"[id]", $id)
Json_Put($ArrayCMT, "."&$id&"[name]", $name)
;~ _ArrayAdd($ArrayCMT, $id)
$i += 1
Wend
$next = Json_Get($JsonObj, '["paging"]["next"]')
If @error Then Return True
If $next<>"" and not @error Then
_GetCMT($next); Gọi đệ quy
EndIf
Return True
EndFunc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment