1) { $link = $matches[1]; if (strpos($link, '/') === 0) $link = 'https://facebook.com'.$link.'"'; if (strpos($link, 'facebook.com/l.php?u=') !== false) $link = urldecode(ExtractFromDelimiters($link, 'facebook.com/l.php?u=', '&')); return ' href="'.$link.'"'; } }; //Utility function for converting facebook emoticons $unescape_fb_emote = function ($matches) { static $facebook_emoticons = array( 'smile' => ':)', 'frown' => ':(', 'tongue' => ':P', 'grin' => ':D', 'gasp' => ':O', 'wink' => ';)', 'pacman' => ':<', 'grumpy' => '>_<', 'unsure' => ':/', 'cry' => ':\'(', 'kiki' => '^_^', 'glasses' => '8-)', 'sunglasses' => 'B-)', 'heart' => '<3', 'devil' => ']:D', 'angel' => '0:)', 'squint' => '-_-', 'confused' => 'o_O', 'upset' => 'xD', 'colonthree' => ':3', 'like' => '👍'); $len = count($matches); if ($len > 1) for ($i = 1; $i < $len; $i++) foreach ($facebook_emoticons as $name => $emote) if ($matches[$i] === $name) return $emote; return $matches[0]; }; $html = ''; if(isset($param['u'])) { if(!strpos($param['u'], "/")) { $html = file_get_html('https://facebook.com/'.urlencode($param['u']).'?_fb_noscript=1') or $this->returnError('No results for this query.', 404); } else { $html = file_get_html('https://facebook.com/pages/'.$param['u'].'?_fb_noscript=1') or $this->returnError('No results for this query.', 404); } } else { $this->returnError('You must specify a Facebook username.', 400); } $element = $html->find('[id^=PagePostsSectionPagelet-]')[0]->children(0)->children(0); if(isset($element)) { $author = str_replace(' | Facebook', '', $html->find('title#pageTitle', 0)->innertext); $profilePic = 'https://graph.facebook.com/'.$param['u'].'/picture?width=200&height=200'; $this->name = $author; foreach($element->children() as $post) { $item = new \Item(); if($post->hasAttribute("data-time")) { //Retrieve post contents $content = preg_replace('/(?i)>