function embedScriptBatch($arrPath, $path2home) { /* Embed multiple javascript files */ foreach ($arrPath as $path) { embedScript($path, $path2home); } }
$curl->setOpt(CURLOPT_TIMEOUT, 20); $curl->setOpt(CURLOPT_HEADER, false); //!important for hide header $curl->setOpt(CURLOPT_ENCODING, ''); //!important for strange characters $curl->setOpt(CURLOPT_FOLLOWLOCATION, true); //!important for allowing redirects $curl->setOpt(CURLOPT_RETURNTRANSFER, true); $curl->setOpt(CURLOPT_MAXREDIRS, 20); $curl->setHeader('User-Agent', 'Mozilla/5.0 (Windows NT 6.2; WOW64; rv:36.0) Gecko/20100101 Firefox/36.0'); $curl->setHeader('Accept-Encoding', 'gzip, deflate'); $curl->setHeader('Host', 'c2.academixdirect.com'); $curl->setHeader('Accept', 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'); $curl->setHeader('Accept-Language', 'en-US,en;q=0.5'); $curl->setHeader('Connection', 'keep-alive'); $curl->setHeader('Referer', _URL_ACADEMIX_SCRAPE); $curl->get(_URL_ACADEMIX_SCRAPE); if ($curl->error) { echo $curl->error_message; exit; } embedScript("jquery.min.js", $path2origin); embedScript("apx_auth.js", $path2origin); $rawHTML_1 = $curl->response; $rawHTML_1 = str_replace("/bundles", "//c2.academixdirect.com/bundles", $rawHTML_1); $html2 = new simple_html_dom(); $html2->load($rawHTML_1); $axdapi_script = $html2->find("script[src='//cdn.axdapi.com/wsk/client.js?v3.18.0']", 0); $axdapi_script->outertext = ""; //$rawHTML_1 = str_replace("landing:window.location.toString()", "landing:'"._URL_ACADEMIX_SCRAPE."'", $rawHTML_1); echo $html2;