scopeConfig->getValue( $config_path, \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); } public function file_get_contents_curl($url, $useragent = null) { $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); if ($useragent) curl_setopt($ch, CURLOPT_USERAGENT, $useragent); curl_setopt( $ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); $data = curl_exec($ch); curl_close($ch); return $data; } function getAttribute($attrib, $tag){ //get attribute from html tag $re = '/'.$attrib.'=["\']?([^"\' ]*)["\' ]/is'; preg_match($re, $tag, $match); if($match){ return urldecode($match[1]); }else { return false; } } function fetch_fb_fans($fb_id, $limit = 10){ $ret = array(); $matches = array(); $url = 'https://www.facebook.com/plugins/likebox.php?href=https://www.facebook.com/' . $fb_id . '&connections=' . $limit; $html = ''; $like_html = $this->file_get_contents_curl($url, 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20100101 Firefox/15.0.1'); $doc = new \DOMDocument('1.0', 'utf-8'); @$doc->loadHTML('' . $like_html); $peopleList = array(); $i = 0; if (!$doc) return false; $result = array(); $link = $doc->getElementById('u_0_4'); $result['link'] = 'https://www.facebook.com/'.$fb_id; $result['like'] = ''; if (isset($link)) { foreach ($link->childNodes as $child) { $result['like'] .= $link->ownerDocument->saveHTML($child); } } foreach ($doc->getElementsByTagName('ul')->item(0)->childNodes as $child) { $raw = $doc->saveXML($child); $li = preg_replace("/