Skip to content

Instantly share code, notes, and snippets.

@nguyenphucbao68
Last active April 1, 2017 11:03
Show Gist options
  • Save nguyenphucbao68/d2495f5173db7adf6cdaa7ea4b65e548 to your computer and use it in GitHub Desktop.
Save nguyenphucbao68/d2495f5173db7adf6cdaa7ea4b65e548 to your computer and use it in GitHub Desktop.
GetListShare Facebook
; #FUNCTION# ====================================================================================================================
; Name ..........: _GetShare
; Description ...: Lấy số lượng share từ ID Post
; Syntax ........: _GetShare($id, $access_token)
; Parameters ....: $id - id post.
; $access_token - Access token.
; Return values .: Success : số lượng share
; Failure : @error set về False
; Author ........: Trojan Nguyen
; ===============================================================================================================================
Func _GetShare($id, $access_token)
If StringInStr($id, "_")=0 or $id="" or $access_token="" then Return SetError(1,0,False)
$link = "https://graph.facebook.com/v2.8/"&$id&"?fields=shares&access_token=" & $access_token
$JsonObj = Json_Decode(_INetGetSource($link))
$count = Json_Get($JsonObj, '["shares"]["count"]')
if $count then
Return $count
Else
Return SetError(1,0,False)
EndIf
EndFunc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment