excelvbafacebook-fql

find verified status for a list of facebook pagenames


I have 782 Facebook page links with their page names in an excel file. I want to find out how many of them are verified by FB. So I started to find a solution. I got few articles that were not relevant to my question and those who were relevant had limited information or something that I could not understand. After searching a bit more I have some home wrote a code given below but it does not echo the verified status. Also how can I use it if I need to check 782 pagenames. Please help...

<?php
function verified($pagename){
    // Query in FQL
    $fql  = "SELECT is_verified";
    $fql .= " FROM page WHERE username = '$pagename'";
    $fqlURL = "https://api.facebook.com/method/fql.query?format=json&query=" . urlencode($fql);

    // Facebook Response is in JSON
    $response = file_get_contents($fqlURL);
    return json_decode($response);
}

$fb = verified('nokia');
echo $fb[0]->is_verified;

?>

EDIT:
More Info:
I searched for it and found that it can be done using fql and api v21 both

https://graph.facebook.com/fql?q=SELECT is_verified FROM page WHERE username=nokia

nokia/?fields=is_verified

Here is the documentation

https://developers.facebook.com/docs/reference/fql/page/

I want help in getting the code repaired and what do i need to do if I have to check 782 pagenames. Presently I have put all those links in mysql myTable table and trying out things. Any help here would be appreciated.


Solution

  • I got it done via excel vba

        Function Status(sPagename As String) As Boolean
    
    
          Static oHTTP As WinHttpRequest
          sURL = "https://graph.facebook.com/fql?q=SELECT is_verified FROM page WHERE username=" & "'" & sPagename & "'"
    
          If oHTTP Is Nothing Then Set oHTTP = New WinHttpRequest
    
    
          On Error GoTo Oops
          With oHTTP
            .Open "GET", sURL, False
            .Send
    
            If InStr(.ResponseText, "true") > 0 Then Status = True
    
    
            Exit Function
          End With
    
    
        Oops:
          Status = False
        End Function
    

    It requires a reference to Microsoft WinHTTP Services to be added

    Thanks for looking into it.