当前位置: 首页>>代码示例>>PHP>>正文


PHP Functions::get_remote_file方法代码示例

本文整理汇总了PHP中Functions::get_remote_file方法的典型用法代码示例。如果您正苦于以下问题:PHP Functions::get_remote_file方法的具体用法?PHP Functions::get_remote_file怎么用?PHP Functions::get_remote_file使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Functions的用法示例。


在下文中一共展示了Functions::get_remote_file方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: load_zip_contents

 function load_zip_contents()
 {
     $this->TEMP_FILE_PATH = create_temp_dir() . "/";
     if ($file_contents = Functions::get_remote_file($this->fishbase_data, array('timeout' => 172800))) {
         $temp_file_path = $this->TEMP_FILE_PATH . "/fishbase.zip";
         $TMP = fopen($temp_file_path, "w");
         fwrite($TMP, $file_contents);
         fclose($TMP);
         $output = shell_exec("tar -xzf {$temp_file_path} -C {$this->TEMP_FILE_PATH}");
         if (!file_exists($this->TEMP_FILE_PATH . "/taxon.txt")) {
             $this->TEMP_FILE_PATH = str_ireplace(".zip", "", $temp_file_path);
             if (!file_exists($this->TEMP_FILE_PATH . "/taxon.txt")) {
                 return;
             }
         }
         $this->text_path['TAXON_PATH'] = $this->TEMP_FILE_PATH . "/taxon.txt";
         $this->text_path['TAXON_COMNAMES_PATH'] = $this->TEMP_FILE_PATH . "/taxon_comnames.txt";
         $this->text_path['TAXON_DATAOBJECT_PATH'] = $this->TEMP_FILE_PATH . "/taxon_dataobject.txt";
         $this->text_path['TAXON_DATAOBJECT_AGENT_PATH'] = $this->TEMP_FILE_PATH . "/taxon_dataobject_agent.txt";
         $this->text_path['TAXON_DATAOBJECT_REFERENCE_PATH'] = $this->TEMP_FILE_PATH . "/taxon_dataobject_reference.txt";
         $this->text_path['TAXON_REFERENCES_PATH'] = $this->TEMP_FILE_PATH . "/taxon_references.txt";
         $this->text_path['TAXON_SYNONYMS_PATH'] = $this->TEMP_FILE_PATH . "/taxon_synonyms.txt";
     } else {
         echo "\n\n Connector terminated. Remote files are not ready.\n\n";
         return;
     }
 }
开发者ID:eliagbayani,项目名称:maps_test,代码行数:27,代码来源:form+eli+FishBaseArchiveAPI.php

示例2: load_xml_string

 function load_xml_string()
 {
     $file_contents = "";
     debug("Please wait, downloading resource document...");
     if (preg_match("/^(.*)\\.(gz|gzip)\$/", $this->xml_path, $arr)) {
         $path_parts = pathinfo($this->xml_path);
         $filename = $path_parts['basename'];
         $temp_dir = create_temp_dir() . "/";
         debug("temp file path: " . $temp_dir);
         if ($file_contents = Functions::get_remote_file($this->xml_path, array('timeout' => 172800))) {
             $temp_file_path = $temp_dir . "/" . $filename;
             $TMP = fopen($temp_file_path, "w");
             fwrite($TMP, $file_contents);
             fclose($TMP);
             shell_exec("gunzip -f {$temp_file_path}");
             $this->xml_path = $temp_dir . str_ireplace(".gz", "", $filename);
             debug("xml path: " . $this->xml_path);
         } else {
             debug("Connector terminated. Remote files are not ready.");
             return false;
         }
         echo "\n {$temp_dir} \n";
         $file_contents = Functions::get_remote_file($this->xml_path, array('timeout' => 172800));
         recursive_rmdir($temp_dir);
         // remove temp dir
         echo "\n temporary directory removed: [{$temp_dir}]\n";
     }
     return $file_contents;
 }
开发者ID:eliagbayani,项目名称:maps_test,代码行数:29,代码来源:ResourceDataObjectElementsSetting.php

示例3: remove_bhl_images_already_existing_in_eol_group

function remove_bhl_images_already_existing_in_eol_group($resource_id)
{
    $file = "http://dl.dropbox.com/u/7597512/BHL_images/BHL_images_in_EOLGroup.txt";
    // $file = "http://localhost/cp/BHL/BHL_images/BHL_images_in_EOLGroup.txt";
    $contents = Functions::get_remote_file($file, array('timeout' => 600, 'download_attempts' => 5));
    $do_ids = json_decode($contents, true);
    print "\n\n from text file: " . count($do_ids);
    $resource_path = CONTENT_RESOURCE_LOCAL_PATH . $resource_id . ".xml";
    $xml_string = Functions::get_remote_file($resource_path, array('timeout' => 240, 'download_attempts' => 5));
    $xml = simplexml_load_string($xml_string);
    $i = 0;
    $deleted_ids = array();
    $deleted = 0;
    foreach ($xml->taxon as $taxon) {
        $i++;
        $dwc = $taxon->children("http://rs.tdwg.org/dwc/dwcore/");
        echo "\n[" . $dwc->ScientificName . "]";
        $j = 0;
        $deleted_do_keys = array();
        foreach ($taxon->dataObject as $do) {
            $j++;
            $dc2 = $do->children("http://purl.org/dc/elements/1.1/");
            $do_id = trim($dc2->identifier);
            if (in_array($do_id, $do_ids)) {
                $deleted++;
                $deleted_ids[$do_id] = 1;
                print "\n --- deleting {$do_id}";
                $deleted_do_keys[] = $j - 1;
            }
        }
        foreach ($deleted_do_keys as $key) {
            unset($xml->taxon[$i - 1]->dataObject[$key]);
        }
    }
    print "\n\n occurrence do_ids: {$i}";
    print "\n\n deleted <dataObject>s: {$deleted}";
    print "\n\n deleted unique do_ids: " . count($deleted_ids);
    $xml_string = $xml->asXML();
    require_library('ResourceDataObjectElementsSetting');
    $xml_string = ResourceDataObjectElementsSetting::delete_taxon_if_no_dataObject($xml_string);
    if (!($WRITE = Functions::file_open($resource_path, "w"))) {
        return;
    }
    fwrite($WRITE, $xml_string);
    fclose($WRITE);
}
开发者ID:eliagbayani,项目名称:maps_test,代码行数:46,代码来源:544.php

示例4: combine_all_xmls

 function combine_all_xmls($resource_id)
 {
     if (!($species_urls = self::get_species_urls())) {
         return;
     }
     debug("\n\n Start compiling all XML...");
     $old_resource_path = CONTENT_RESOURCE_LOCAL_PATH . $resource_id . ".xml";
     if (!($OUT = fopen($old_resource_path, "w+"))) {
         debug(__CLASS__ . ":" . __LINE__ . ": Couldn't open file: " . $old_resource_path);
         return;
     }
     $str = "<?xml version='1.0' encoding='utf-8' ?>\n";
     $str .= "<response\n";
     $str .= "  xmlns='http://www.eol.org/transfer/content/0.3'\n";
     $str .= "  xmlns:xsd='http://www.w3.org/2001/XMLSchema'\n";
     $str .= "  xmlns:dc='http://purl.org/dc/elements/1.1/'\n";
     $str .= "  xmlns:dcterms='http://purl.org/dc/terms/'\n";
     $str .= "  xmlns:geo='http://www.w3.org/2003/01/geo/wgs84_pos#'\n";
     $str .= "  xmlns:dwc='http://rs.tdwg.org/dwc/dwcore/'\n";
     $str .= "  xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'\n";
     $str .= "  xsi:schemaLocation='http://www.eol.org/transfer/content/0.3 http://services.eol.org/schema/content_0_3.xsd'>\n";
     fwrite($OUT, $str);
     $i = 0;
     $total = sizeof($species_urls);
     foreach ($species_urls as $filename) {
         $i++;
         print "\n {$i} of {$total}";
         sleep(2);
         $contents = Functions::get_remote_file($filename);
         if ($xml = simplexml_load_string($contents)) {
             $contents = str_ireplace("http://creativecommons.org/licenses/by-nc-sa/2.5/mx/", "http://creativecommons.org/licenses/by-nc-sa/2.5/", $contents);
             if ($contents) {
                 $pos1 = stripos($contents, "<taxon>");
                 $pos2 = stripos($contents, "</response>");
                 $str = substr($contents, $pos1, $pos2 - $pos1);
                 fwrite($OUT, $str);
             }
         } else {
             print "\n {$filename} - invalid XML";
             continue;
         }
     }
     fwrite($OUT, "</response>");
     fclose($OUT);
     print "\n All XML compiled\n -end-of-process- \n";
 }
开发者ID:eliagbayani,项目名称:maps_test,代码行数:46,代码来源:DutchSpeciesCatalogueAPI.php

示例5: clean_media_extension

 function clean_media_extension($resource_id, $dwca_file)
 {
     require_library('connectors/INBioAPI');
     $func = new INBioAPI();
     if ($paths = $func->extract_archive_file($dwca_file, "meta.xml")) {
         print_r($paths);
         if ($contents = Functions::get_remote_file($paths['archive_path'] . "media.txt", array('timeout' => 172800))) {
             $contents = str_ireplace('<a title=""', '<a title="', $contents);
             $contents = str_ireplace('"" href=""', '" href="', $contents);
             $contents = str_ireplace('"">', '">', $contents);
             //saving new media.txt
             if (!($WRITE = fopen($paths['archive_path'] . "media.txt", "w"))) {
                 debug(__CLASS__ . ":" . __LINE__ . ": Couldn't open file: " . $paths['archive_path'] . "media.txt");
                 return;
             }
             fwrite($WRITE, $contents);
             fclose($WRITE);
             // remove the archive file e.g. plazi.zip
             $info = pathinfo($dwca_file);
             unlink($paths['archive_path'] . $info["basename"]);
             // creating the archive file
             $command_line = "tar -czf " . CONTENT_RESOURCE_LOCAL_PATH . $resource_id . ".tar.gz --directory=" . $paths['archive_path'] . " .";
             $output = shell_exec($command_line);
             // moving files to /resources/
             recursive_rmdir(CONTENT_RESOURCE_LOCAL_PATH . $resource_id);
             if (!file_exists(CONTENT_RESOURCE_LOCAL_PATH . $resource_id)) {
                 mkdir(CONTENT_RESOURCE_LOCAL_PATH . $resource_id);
             }
             $src = $paths['archive_path'];
             $dst = CONTENT_RESOURCE_LOCAL_PATH . $resource_id . "/";
             $files = glob($paths['archive_path'] . "*.*");
             foreach ($files as $file) {
                 $file_to_go = str_replace($src, $dst, $file);
                 copy($file, $file_to_go);
             }
         }
         // remove temp dir
         recursive_rmdir($paths['archive_path']);
         echo "\n temporary directory removed: " . $paths['archive_path'];
     }
 }
开发者ID:eliagbayani,项目名称:maps_test,代码行数:41,代码来源:PlaziArchiveAPI.php

示例6: dirname

$url_list_of_group_ids = "http://www.morphbank.net/eolids.xml";
*/
include_once dirname(__FILE__) . "/../../config/environment.php";
$timestart = time_elapsed();
$mysqli =& $GLOBALS['mysqli_connection'];
$resource_id = 83;
$details_method_prefix = "http://services.morphbank.net/mb3/request?method=id&format=svc&limit=2&id=";
$image_ids = array();
$schema_taxa = array();
$used_taxa = array();
$url_list_of_image_ids = "http://services.morphbank.net/mb3/request?method=eol&format=id&limit=-1";
/* Excludes MorphBank IDs as suggested by BioImages Vanderbuilt */
$excluded_MorphBank_IDs = prepare_excluded_ids();
if ($url_list_of_image_ids) {
    print "\n [url_list_of_image_ids: {$url_list_of_image_ids}] \n";
    $response = Functions::get_remote_file($url_list_of_image_ids, array('download_wait_time' => 1000000, 'timeout' => 600, 'download_attempts' => 5));
    $image_id_xml = simplexml_load_string($response);
    if ($image_id_xml) {
        foreach ($image_id_xml->id as $id) {
            $image_ids[] = $id;
        }
    }
}
$total_image_ids = count($image_ids);
print "\n count of image ID's = {$total_image_ids}";
if ($total_image_ids == 0) {
    exit("\n Program will terminate. MorphBank service not ready.");
}
/* loop through image ids */
$k = 0;
foreach ($image_ids as $image_id) {
开发者ID:eliagbayani,项目名称:maps_test,代码行数:31,代码来源:83.php

示例7: lookup_with_cache

 public static function lookup_with_cache($url, $options = array())
 {
     // default expire time is 30 days
     if (!isset($options['expire_seconds'])) {
         $options['expire_seconds'] = 2592000;
     }
     if (!isset($options['timeout'])) {
         $options['timeout'] = 120;
     }
     // if(!isset($options['cache_path'])) $options['cache_path'] = DOC_ROOT . "tmp/cache/";
     if (!isset($options['cache_path'])) {
         $options['cache_path'] = "/Volumes/Eli black/eol_cache/";
     }
     $md5 = md5($url);
     $cache1 = substr($md5, 0, 2);
     $cache2 = substr($md5, 2, 2);
     if ($resource_id = @$options['resource_id']) {
         $options['cache_path'] .= "{$resource_id}/";
         if (!file_exists($options['cache_path'])) {
             mkdir($options['cache_path']);
         }
     }
     if (!file_exists($options['cache_path'] . $cache1)) {
         mkdir($options['cache_path'] . $cache1);
     }
     if (!file_exists($options['cache_path'] . "{$cache1}/{$cache2}")) {
         mkdir($options['cache_path'] . "{$cache1}/{$cache2}");
     }
     $cache_path = $options['cache_path'] . "{$cache1}/{$cache2}/{$md5}.cache";
     if (file_exists($cache_path)) {
         $file_contents = file_get_contents($cache_path);
         $cache_is_valid = true;
         if (@$options['validation_regex'] && !preg_match("/" . $options['validation_regex'] . "/ims", $file_contents)) {
             $cache_is_valid = false;
         }
         if ($file_contents && $cache_is_valid || strval($file_contents) == "0" && $cache_is_valid) {
             $file_age_in_seconds = time() - filemtime($cache_path);
             if ($file_age_in_seconds < $options['expire_seconds']) {
                 return $file_contents;
             }
             if ($options['expire_seconds'] === false) {
                 return $file_contents;
             }
         }
         @unlink($cache_path);
     }
     $file_contents = Functions::get_remote_file($url, $options);
     if ($FILE = Functions::file_open($cache_path, 'w+')) {
         fwrite($FILE, $file_contents);
         fclose($FILE);
     } else {
         if (!($h = Functions::file_open(DOC_ROOT . "/public/tmp/cant_delete.txt", 'a'))) {
             return;
         }
         fwrite($h, $cache_path . "\n");
         fclose($h);
     }
     return $file_contents;
 }
开发者ID:eliagbayani,项目名称:maps_test,代码行数:59,代码来源:Functions.php

示例8: pools_get_photos

 public static function pools_get_photos($group_id, $machine_tag, $per_page, $page, $auth_token = "", $user_id = NULL, $start_date = NULL, $end_date = NULL)
 {
     $extras = "last_update,media,url_o";
     $url = self::generate_rest_url("flickr.groups.pools.getPhotos", array("group_id" => $group_id, "machine_tags" => $machine_tag, "extras" => $extras, "per_page" => $per_page, "page" => $page, "auth_token" => $auth_token, "user_id" => $user_id, "format" => "json", "nojsoncallback" => 1), 1);
     if (in_array($user_id, array(FLICKR_BHL_ID, FLICKR_SMITHSONIAN_ID))) {
         /* remove group_id param to get images from photostream, and not only those in the EOL Flickr group */
         $url = self::generate_rest_url("flickr.photos.search", array("machine_tags" => $machine_tag, "extras" => $extras, "per_page" => $per_page, "page" => $page, "auth_token" => $auth_token, "user_id" => $user_id, "license" => "1,2,4,5,7", "privacy_filter" => "1", "sort" => "date-taken-asc", "min_taken_date" => $start_date, "max_taken_date" => $end_date, "format" => "json", "nojsoncallback" => 1), 1);
     }
     return json_decode(Functions::get_remote_file($url, array('timeout' => 30)));
 }
开发者ID:eliagbayani,项目名称:maps_test,代码行数:10,代码来源:FlickrAPI+orig.php

示例9: assemble_xml_files

 function assemble_xml_files()
 {
     $arr_taxa = array();
     $arr_predator = array();
     $arr_prey = array();
     $arr_ref = array();
     for ($i = 1; $i <= 259; $i++) {
         print "\n {$i} ---" . SPIRE_SERVICE . $i;
         if (!($str = Functions::get_remote_file(SPIRE_SERVICE . $i))) {
             echo "\n\nSPIRE service not available at the moment.\n\n";
             return false;
         }
         $str = str_replace('rdf:resource', 'rdf_resource', $str);
         $str = utf8_encode($str);
         $xml = simplexml_load_string($str);
         foreach ($xml->ConfirmedFoodWebLink as $rec) {
             foreach ($rec->predator[0]->attributes() as $attribute => $value) {
                 $arr = parse_url($value);
                 $predator = trim(@$arr['fragment']);
                 $predator = str_replace("_", " ", $predator);
             }
             $pred_desc = trim($rec->predator_description);
             foreach ($rec->prey[0]->attributes() as $attribute => $value) {
                 $arr = parse_url($value);
                 $prey = trim(@$arr['fragment']);
                 $prey = str_replace("_", " ", $prey);
             }
             $prey_desc = trim($rec->prey_description);
             foreach ($rec->observedInStudy[0]->attributes() as $attribute => $value) {
                 $arr = parse_url($value);
                 $ref_num = trim($arr['fragment']);
             }
             $arr_taxa[$predator]['desc'] = $pred_desc;
             $arr_taxa[$prey]['desc'] = $prey_desc;
             if (!@$arr_predator[$predator]) {
                 $arr_predator[$predator][] = $prey;
             }
             if (!@$arr_prey[$prey]) {
                 $arr_prey[$prey][] = $predator;
             }
             if (!in_array($prey, $arr_predator[$predator])) {
                 $arr_predator[$predator][] = $prey;
             }
             if (!in_array($predator, $arr_prey[$prey])) {
                 $arr_prey[$prey][] = $predator;
             }
             if (!@$arr_ref[$ref_num]['predator']) {
                 $arr_ref[$ref_num]['predator'][] = $predator;
             }
             if (!@$arr_ref[$ref_num]['prey']) {
                 $arr_ref[$ref_num]['prey'][] = $prey;
             }
             if (!in_array($predator, $arr_ref[$ref_num]['predator'])) {
                 $arr_ref[$ref_num]['predator'][] = $predator;
             }
             if (!in_array($prey, $arr_ref[$ref_num]['prey'])) {
                 $arr_ref[$ref_num]['prey'][] = $prey;
             }
         }
         foreach ($xml->Study as $rec) {
             $habitats = array();
             foreach ($rec->ofHabitat as $habitat) {
                 foreach ($habitat->attributes() as $attribute => $value) {
                     $arr = parse_url($value);
                     $habitat = trim($arr['fragment']);
                     $habitats[] = str_replace("_", " ", $habitat);
                 }
             }
             $habitats = implode(", ", $habitats);
             if ($habitats == "unknown") {
                 $habitats = "";
             }
             $place = self::parse_locality(trim($rec->locality));
             $country = @$place["country"];
             $state = @$place["state"];
             $locality = @$place["locality"];
             //debug
             /*
             if  (   is_numeric(stripos(trim($rec->titleAndAuthors),"Animal Diversity Web"))     ||
                     is_numeric(stripos(trim($rec->titleAndAuthors),"Rockefeller"))              ||
                     is_numeric(stripos(trim($rec->titleAndAuthors),"data base of food webs"))   ||
                     is_numeric(stripos(trim($rec->titleAndAuthors),"foodwebs"))                 ||
                     is_numeric(stripos(trim($rec->titleAndAuthors),"Webs on the Web"))          ||
                     is_numeric(stripos(trim($rec->titleAndAuthors),"NCEAS"))                    ||
                     is_numeric(stripos(trim($rec->titleAndAuthors),"Interaction Web Database")) ||
                     is_numeric(stripos(trim($rec->titleAndAuthors),"Co-Operative Web Bank"))
                 )
             {print"\n problem here: [$i] [trim($rec->titleAndAuthors)]";}
             */
             $titleAndAuthors = trim($rec->titleAndAuthors);
             if ($titleAndAuthors == "Animal Diversity Web") {
                 $titleAndAuthors = "Myers, P., R. Espinosa, C. S. Parr, T. Jones, G. S. Hammond, and T. A. Dewey. 2006. The Animal Diversity Web (online). Accessed February 16, 2011 at http://animaldiversity.org. http://www.animaldiversity.org";
             }
             $reference[$ref_num] = array("titleAndAuthors" => $titleAndAuthors, "publicationYear" => trim($rec->publicationYear), "place" => trim($rec->locality), "country" => $country, "state" => $state, "locality" => $locality, "habitat" => $habitats);
         }
     }
     //main loop 1-259
     //for ancestry
     require_library('XLSParser');
     $parser = new XLSParser();
//.........这里部分代码省略.........
开发者ID:eliagbayani,项目名称:maps_test,代码行数:101,代码来源:SpireAPI.php

示例10: get_main_groups

 private function get_main_groups()
 {
     $groups = array();
     if ($html = Functions::get_remote_file($this->domain, array('timeout' => 9600, 'download_attempts' => 2, 'delay_in_minutes' => 5))) {
         if (preg_match_all("/href=\"vm_search\\.php(.*?)\"/ims", $html, $match)) {
             foreach ($match[1] as $line) {
                 if (preg_match("/database\\=(.*?)\\&/ims", $line, $match2)) {
                     $groups[] = $match2[1];
                 }
             }
         }
     } else {
         echo "\n investigate: main site is down\n";
     }
     print_r($groups);
     return $groups;
 }
开发者ID:eliagbayani,项目名称:maps_test,代码行数:17,代码来源:ADUVirtualMuseumAPI.php

示例11: load_zip_contents

 function load_zip_contents()
 {
     $this->TEMP_FILE_PATH = create_temp_dir() . "/";
     if ($file_contents = Functions::get_remote_file($this->zip_path, array('timeout' => 999999, 'download_attempts' => 5))) {
         $parts = pathinfo($this->zip_path);
         $temp_file_path = $this->TEMP_FILE_PATH . "/" . $parts["basename"];
         if (!($TMP = fopen($temp_file_path, "w"))) {
             debug(__CLASS__ . ":" . __LINE__ . ": Couldn't open file: " . $temp_file_path);
             return;
         }
         fwrite($TMP, $file_contents);
         fclose($TMP);
         $output = shell_exec("unzip {$temp_file_path} -d {$this->TEMP_FILE_PATH}");
         if (file_exists($this->TEMP_FILE_PATH . "/all.xml")) {
             return TRUE;
         } else {
             return FALSE;
         }
     } else {
         debug("\n\n Connector terminated. Remote files are not ready.\n\n");
         return FALSE;
     }
 }
开发者ID:eliagbayani,项目名称:maps_test,代码行数:23,代码来源:NbiiImagesAPI.php

示例12: process_file1

function process_file1($file, $doc_id)
{
    global $wrap;
    global $used_taxa;
    print "{$wrap}";
    $str = Functions::get_remote_file($file);
    $str = clean_str($str);
    $str = str_ireplace('<br><br>', "&arr[]=", $str);
    $str = trim($str);
    $str = substr($str, 0, strlen($str) - 7);
    //to remove last part of string "&arr[]="
    //print "<hr>$str";
    $arr = array();
    parse_str($str);
    print "after parse_str recs = " . count($arr) . "{$wrap} {$wrap}";
    //print_r($arr);
    //print"<pre>";print_r($arr);print"</pre>";
    $i = 0;
    foreach ($arr as $str) {
        $str = clean_str($str);
        $str = str_ireplace("< /i>", "</i>", $str);
        //if($i >= 5)break; //debug        //ditox
        $i++;
        // if(in_array($i,array(8))){
        if (true) {
            //<b><i>Abrus precatorius</i></b>
            //get sciname
            $beg = '<b>';
            $end1 = '</i></b>';
            $end2 = '</i>';
            $end3 = '</b>';
            $sciname = strip_tags(trim(parse_html($str, $beg, $end1, $end2, $end3, $end1, "")));
            $sciname = str_ireplace(chr(13), "", $sciname);
            $sciname = str_ireplace(chr(10), "", $sciname);
            $sciname = trim($sciname);
            //get desc
            $str .= "xxx";
            $beg = '</i></b>';
            $end1 = 'xxx';
            $desc = strip_tags(trim(parse_html($str, $beg, $end1, $end1, $end1, $end1, "")));
            $last_char_of_desc = substr($desc, strlen($desc) - 1, 1);
            if ($last_char_of_desc == ",") {
                $desc = substr($desc, 0, strlen($desc) - 1);
            }
            $desc .= ".";
            if ($sciname == "") {
                print "jjj";
            }
            print "{$i}. {$sciname} {$wrap}";
            //print "$desc";
            prepare_agent_rights($doc_id, $sciname, $desc);
        }
    }
    //main loop
}
开发者ID:eliagbayani,项目名称:maps_test,代码行数:55,代码来源:108.php

示例13: build_id_list

 function build_id_list()
 {
     if (!($OUT = fopen($this->TEMP_FILE_PATH . "tropicos_ids.txt", "w"))) {
         debug(__CLASS__ . ":" . __LINE__ . ": Couldn't open file: " . $this->TEMP_FILE_PATH . "tropicos_ids.txt");
         return;
     }
     $startid = 0;
     // debug orig value 0; 1600267 with mediaURL and <location>; 1201245 with thumbnail size images
     //pagesize is the no. of records returned from Tropicos master list service
     $pagesize = 1000;
     // debug orig value 1000
     $count = 0;
     while (true) {
         $count++;
         $url = TROPICOS_API_SERVICE . "List?startid={$startid}&PageSize={$pagesize}&apikey=" . TROPICOS_API_KEY . "&format=json";
         echo "\n[{$count}] {$url}";
         if ($json_ids = Functions::get_remote_file($url, DOWNLOAD_WAIT_TIME, array('timeout' => 4800, 'download_attempts' => 5))) {
             $ids = json_decode($json_ids, true);
             $str = "";
             foreach ($ids as $id) {
                 if ($id["NameId"]) {
                     $str .= $id["NameId"] . "\n";
                     $startid = $id["NameId"];
                 } else {
                     echo "\n nameid undefined";
                 }
             }
             $startid++;
             // to avoid duplicate ids, set next id to get
             if ($str != "") {
                 fwrite($OUT, $str);
             }
         } else {
             echo "\n --server not accessible-- \n";
             break;
         }
         if ($count == 1300) {
             break;
         }
         // normal operation
         // break; //debug
     }
     fclose($OUT);
 }
开发者ID:eliagbayani,项目名称:maps_test,代码行数:44,代码来源:TropicosAPI.php

示例14: load_zip_contents

 private function load_zip_contents($zip_path, $download_options, $files, $extension)
 {
     $text_path = array();
     $temp_path = create_temp_dir();
     if ($file_contents = Functions::get_remote_file($zip_path, $download_options)) {
         $parts = pathinfo($zip_path);
         $temp_file_path = $temp_path . "/" . $parts["basename"];
         if (!($TMP = Functions::file_open($temp_file_path, "w"))) {
             return;
         }
         fwrite($TMP, $file_contents);
         fclose($TMP);
         $output = shell_exec("unzip {$temp_file_path} -d {$temp_path}");
         if (file_exists($temp_path . "/" . $files[0] . $extension)) {
             foreach ($files as $file) {
                 $text_path[$file] = $temp_path . "/" . $file . $extension;
             }
         } else {
             return;
         }
     } else {
         debug("\n\n Connector terminated. Remote files are not ready.\n\n");
     }
     return $text_path;
 }
开发者ID:eliagbayani,项目名称:maps_test,代码行数:25,代码来源:FEISDataConnector.php

示例15: dirname

<?php

namespace php_active_record;

include_once dirname(__FILE__) . "/../../config/environment.php";
$new_resource_path = DOC_ROOT . "temp/22.xml.gz";
$new_resource = Functions::get_remote_file("http://animaldiversity.ummz.umich.edu/XML/adw_eol.xml.gz");
// $new_resource = Functions::get_remote_file("http://localhost/eol_php_code/applications/content_server/resources/adw_eol.xml.gz");
if (!($OUT = fopen($new_resource_path, "w+"))) {
    debug(__CLASS__ . ":" . __LINE__ . ": Couldn't open file: " . $new_resource_path);
    return;
}
fwrite($OUT, $new_resource);
fclose($OUT);
shell_exec("gunzip -f " . $new_resource_path);
$new_resource_path = DOC_ROOT . "temp/22.xml";
$xml = file_get_contents($new_resource_path);
// $xml = str_replace("<dc:description>", "<dc:description><![CDATA[", $xml);
// $xml = str_replace("</dc:description>", "]]></dc:description>", $xml);
$xml = preg_replace("/<a>([^<]+)<\\/a>/", "\\1", $xml);
if (substr_count($xml, "<?xml") == 0) {
    $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" . $xml;
}
$old_resource_path = CONTENT_RESOURCE_LOCAL_PATH . "22.xml";
if (!($OUT = fopen($old_resource_path, "w+"))) {
    debug(__CLASS__ . ":" . __LINE__ . ": Couldn't open file: " . $old_resource_path);
    return;
}
fwrite($OUT, $xml);
fclose($OUT);
shell_exec("rm " . $new_resource_path);
开发者ID:eliagbayani,项目名称:maps_test,代码行数:31,代码来源:22.php


注:本文中的Functions::get_remote_file方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。