title: validity of facebook page whther it really exists and its url structure
body: <p>I have spent a couple of hours on how to validate Facebook PAGES. I found and read lot of articles/posts but did not find something that matches my requirement. I wanted to convert a user input url ($rawurl) into a format that I want ($goodurl) and on googling, i found regex is the way to do it but it is very complicated and difficult to understand and need help. </p>
  
  <p>The user can enter URL the way he/she likes 
  example: </p>
  
  <pre><code>http://facebook.com/WillSmith, 
  https://facebook.com/WillSmith, 
  http://www.facebook.com/WillSmith, 
  https://www.facebook.com/WillSmith, 
  www.facebook.com/WillSmith 
  or just facebook.com/WillSmith 
  </code></pre>
  
  <p>Or any other way. Not only this, other than the vanity url format, the facebook pages also comes with other format like facebook.com/pages/usernames/somenumbers. Subdomains such as en-gb.facebook.com makes things more difficult. So after googling more, I found a regex <code>http[s]?://(www|[a-zA-Z]{2}-[a-zA-Z]{2})\.facebook\.com/(pages/[a-zA-Z0-9\.-]+/[0-9]+|[a-zA-Z0-9\.-]+)[/]?$</code> but not sure if it will take care of all the above conditions.</p>
  
  <p>Help what I need:
  1. The standard format I need is <code>https://www.facebook.com/WillSmith</code>
  2. I also need to check if it is a valid URL. eg.the above url is valid and if you see this url <code>https://www.facebook.com/WillSmith555</code>, it fits the valid criteria but there is no such page on Facebook. It says "Sorry, this page isn't available.  The link you followed may be broken, or the page may have been removed" with a broken thumbsup picture.</p>
  
  <p>After checking these two criteria, I need an echo in the php file whether the url entered by user is valid or invalid after doing a regex conversion.</p>
  
  <p>Please help.</p>