According to facebook's help forum, even the official name-availability checker doesn't work. So you won't have much luck creating your own version. Plus, facebook custom names are optional, not every account has them.

What are you doing this for? What benefit does it serve your clients to check some other site for available usernames?

Why canít I use certain words like "drop" as part of my Security Question answers?
There are certain words used by hackers to try to gain access to systems and manipulate data; therefore, the following words are restricted: "select," "delete," "update," "insert," "drop" and "null".