I have a script which will generate random numbers like 1000089838938 but I need a solution to check if the generated number is associated with a valid facebook account.
Solution I am looking for should be in PHP.
Thanks.
I have a script which will generate random numbers like 1000089838938 but I need a solution to check if the generated number is associated with a valid facebook account.
Solution I am looking for should be in PHP.
Thanks.
One solution is to check ID after generating via Graph API.
http://graph.facebook.com/[ID]
whatever ID is generated, put that at end of URL and check response received. Like if ID is 1303834107
you can check @ http://graph.facebook.com/1303834107
If it's correct, response will be something like:
{
"id": "1303834107",
"name": "John Flake",
"first_name": "John",
"last_name": "Flake",
"link": "https://www.facebook.com/john.flake",
"username": "john.flake",
"gender": "male",
"locale": "en_US"
}
or if that ID is invalid, you will get something like:
{
"error":
{
"message": "Unsupported get request.",
"type": "GraphMethodException",
"code": 100
}
}
Based on response, you can validate that ID.
Use php curl to call each time the API URL when ID is generated to check the response.