I am using PHP to try to clear a page that seems to dynamically load content in just milliseconds after the parent page has finished loading.
I use curl to parse the page and simpleHtmlDom to rip things out of the parsed html.
My efforts to intersect the DOM and explode () objects from html return nothing. My only ideas was that it would load the content after loading the parent page.
Here is my code.
<?
$url = 'http://www.facebook.com/OneAndroidAppaDay';
$scrapeUrl = 'http://www.facebook.com/OneAndroidAppaDay';
include_once('simple_html_dom.php');
require_once("bitly.php");
$userAgent = 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)';
$ch = curl_init();
curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);
curl_setopt($ch, CURLOPT_URL,$scrapeUrl);
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_AUTOREFERER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
$html = curl_exec($ch);
if (!$html) {
echo "<br />cURL error number:" .curl_errno($ch);
echo "<br />cURL error:" . curl_error($ch);
exit;
}
$appBitlyUrl = $html->find('div[class=UIStoryAttachment_Title]',0)->find('a',0)->href;
echo 'Bitly Url: ' . $appBitlyUrl;
?>
It explodes on line 24 (indicated by a built-in comment) with this error:
Fatal error: call of function-member of function () for non-object in / home / xxxxxxxx / public _html / xxx.xx / xxxx.php on line 24
, html? , , - ?