Posts

Showing posts from July, 2019

Scrape Facebook fanpage without API and get HTML content.

Hello there, the code below can be used to scrape any Facebook fanpage using CURL and there is no API credentials needed. Of course the fanpage has to be public as most are. <?php $fanPageName = "DisneyTheLionKing" ; $ch = curl_init ( "http://www.facebook.com/" . $fanPageName ) ; curl_setopt ( $ch , CURLOPT_POST , false ) ; curl_setopt ( $ch , CURLOPT_FOLLOWLOCATION , true ) ; curl_setopt ( $ch , CURLOPT_USERAGENT , "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7" ) ; curl_setopt ( $ch , CURLOPT_HEADER , false ) ; curl_setopt ( $ch , CURLOPT_RETURNTRANSFER , true ) ; $data = curl_exec ( $ch ) ; echo htmlentities ( $data ) ; ------------------- Output - Not everything pasted here but just to show you. <!DOCTYPE html> <html lang="en" id="facebook" class="no_js"> <head><meta charset="utf-8" /><meta name=&q