function getremotefile($url, $filename, $dir) { $zip = getremotecontent($url); if ($zip == '') { return false; } $fp = @fopen($dir . $filename, 'w'); fwrite($fp, $zip); fclose($fp); return true; }
$narr[] = $queries[$mkey]; } $queries = $narr; $tarr = getTopResults($queries, $todown, $msnkey, $culture_info); $k = 0; // get top results foreach ($tarr as $manUrl) { //get content of downloaded web document // in php ini allow_url_fopen = On $path = $manUrl->mainUrl; // get content from the remote file $mega = array(); // get content and get encoding if (trim($path) != "") { try { $result = getremotecontent($path); if (trim($result) == "") { continue; } } catch (Exception $e) { print_error("exception in downloading!\n"); $result = "Was not able to download the respective resource"; } } else { continue; } $result = mb_ereg_replace('#\\s{2,}#', ' ', $result); // split into strings and remove empty ones $strs = explode("\n", $result); $result = ""; foreach ($strs as $st) {