I am trying to learn how to build a facebook group crawler that gets information from the group (a list of posts from the group with information of who wrote the post, post id, post date, ect'.
It's important to for me to state that I am in the beginning of my research of page crawling!
Found a nice tutorial from this page: http://www.oooff.com/php-scripts/basic-curl-scraping-php/basic-scraping-with-curl.php
When running this code:
<?php
$url = "http://www.oooff.com/";
$ch = curl_init($url); // initialize the CURL library in my PHP script so we can later work on it - inside the handler.
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // curl_setopt() function is used to set options on the $ch handler.// in this case we use the CURLOPT_RETURNTRANSFER option
$curl_scraped_page = curl_exec($ch); // "run all the stuff we've set" - return the data scraped to the variable $curl_scraped_page
curl_close($ch);
echo $curl_scraped_page;
?>
It works, but sometimes when I run it I get a blank page.
when I run it on facebook (or more specificaly on a FB group because that's what I need) I get a blank page. I tried running it on yahoo.com and I get the same result.
- Why is that happening?
- What is the right way to get a page content?