0

i am new to android development,and currently working on a new app. On a registeration page,i need to make sure that the user's facebook account actually exists.I thought of doing that by checking whether or not the user's facebook full url returns "Page not found " or not,and base the authenticity of his account on that.

i will be glad to know how that can be done(without opening a visible web page;simply getting the title of a url(for example:the following url's title is "Page not found" which indicates that the user does not exist: https://www.facebook.com/examplenotexist)

IF This solution is possible,i will be more than glad to receive an explanation of how to get this information .

Regards,

Fiver
  • 9,909
  • 9
  • 43
  • 63
user44088
  • 7
  • 3
  • use the http HEAD command to retreive the headers of a page. the status will be 404 if the page does not exist. – njzk2 Oct 29 '13 at 20:10

1 Answers1

0

Your solution would work, but why not use the Facebook Graph API?

You can use a URL scheme like https://graph.facebook.com/fakeaccount and examine the JSON response to determine if the account exists.

There are numerous libraries you can use to parse the response in Java. This answer does a great job explaining how you can accomplish this.

edit: coincidentally, someone has used the username 'fakeaccount', but you get the gist I'm sure :)

Community
  • 1
  • 1
Ben Siver
  • 2,758
  • 1
  • 25
  • 42
  • Thanks,i had no idea this service exists.can you possibly explain how to check the json response(code-wise).also,will the following url scheme work with hebrew account names? – user44088 Oct 29 '13 at 20:35
  • Sure thing, I updated my answer with some details on how to parse JSON. As for the Hebrew account names, I am not sure (but you could test it easily!). It may work if you supply the escaped unicode representation of the Hebrew name, but that's just a guess. p.s. if this helped, consider accepting my answer. Thanks! – Ben Siver Oct 29 '13 at 20:54
  • Thank you very much,i believe it will solve my problem.i accepted your answer :D – user44088 Oct 29 '13 at 21:11
  • as for the hebrew:i found out that searching in languages other than hebrew can only be done using the id(searching the id number on the graph.facebook)for instance:https://he-il.facebook.com/people/100000905594497/nameofuser – user44088 Oct 29 '13 at 21:15
  • I see, I'm glad there is a solution for you. Hopefully it's not too much of a hassle to find the user's id. – Ben Siver Oct 29 '13 at 21:20