title: facebook fan page user data extraction php
body: <p>To extract list of users of a particular facebook fan page am using the below code</p>
  
  <pre><code>$text = file_get_contents('rawnike.php');
   //  $text = file_get_contents('http://www.facebook.com/plugins/fan.php?connections=10000&amp;id=15087023444');
  
     $text = preg_replace("/&lt;script[^&gt;]+\&gt;/i", "", $text);
     $text = preg_replace("/&lt;img[^&gt;]+\&gt;/i", "", $text);
  
  
  $pattern = '!(https?://[^\s]+)!'; // refine this for better/more specific results
  
  if (preg_match_all($pattern, $text, $matches)) {
      list(, $links) = ($matches);
      //print_r($links); 
      //var_dump($links);
  }
  
  unset($links[0]);unset($links[1]);unset($links[2]);unset($links[3]);unset($links[4]);unset($links[5]);unset($links[6]);unset($links[7]);
   //var_dump($links);
   $links=str_replace('https','http',$links); $links=str_replace('\"','',$links);
  foreach ($links as $value) {
      echo "fb user ID: $value&lt;br /&gt;\n";
  }
  </code></pre>
  
  <p>And by this am successfully retrieving users' profile links using <code>file_get_contents('rawnike.php')</code> (rawnike.php locally saved)</p>
  
  <p>but if I try to pull the same from url <code>file_get_contents("http://www.facebook.com/plugins/fan.php?connections=10000&amp;id=15087023444")</code> <br/> am not able to retrieve, which means I cannot extract facebook page's source directly! I should save the page's source manually! </p>
  
  <p>The same I observed when parsing a user's page if I manually stores page's source code locally and parse it, am able to extract user's interest. On the other hand if I directly try to extract source code with URL, its not getting the same source. </p>
  
  <p>Which means <code>$source=file_get_contents($url); $source="content which displays ur browser doesnt supported or some crap"</code>  on other hand <code>$source=file_get_contents($string_to_extract_content_of_local_saved_sourceFile); $source="content which i excatly needed to parse"</code></p>
  
  <p>On doing little research I understood that <code>FQL</code> is right approach for doing things like this. But pls help me understand why there is difference in sources code extracted and is <code>FQL</code> is the only way or in some other way I can proceed ahead.</p>