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


PHP http_download_file函数代码示例

本文整理汇总了PHP中http_download_file函数的典型用法代码示例。如果您正苦于以下问题:PHP http_download_file函数的具体用法?PHP http_download_file怎么用?PHP http_download_file使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: sitemaps_build

/**
 * Top level function to (re)generate a Sitemap (xml file, Google-style).
 */
function sitemaps_build()
{
    $GLOBALS['NO_QUERY_LIMIT'] = true;
    $path = get_custom_file_base() . '/ocp_sitemap.xml';
    if (!file_exists($path)) {
        if (!is_writable_wrap(dirname($path))) {
            warn_exit(do_lang_tempcode('WRITE_ERROR_CREATE', escape_html('/')));
        }
    } else {
        if (!is_writable_wrap($path)) {
            warn_exit(do_lang_tempcode('WRITE_ERROR', escape_html('ocp_sitemap.xml')));
        }
    }
    // Runs via a callback mechanism, so we don't need to load an arbitrary complex structure into memory.
    sitemaps_xml_initialise($path);
    spawn_page_crawl('pagelink_to_sitemapsxml', $GLOBALS['FORUM_DRIVER']->get_guest_id(), NULL, DEPTH__ENTRIES);
    sitemaps_xml_finished();
    // Ping search engines
    if (get_option('auto_submit_sitemap') == '1') {
        $ping = true;
        $base_url = get_base_url();
        $not_local = substr($base_url, 0, 16) != 'http://localhost' && substr($base_url, 0, 16) != 'http://127.0.0.1' && substr($base_url, 0, 15) != 'http://192.168.' && substr($base_url, 0, 10) != 'http://10.';
        if ($ping && get_option('site_closed') == '0' && $not_local) {
            // Submit to search engines
            $services = array('http://www.google.com/webmasters/tools/ping?sitemap=', 'http://submissions.ask.com/ping?sitemap=', 'http://www.bing.com/webmaster/ping.aspx?siteMap=', 'http://search.yahooapis.com/SiteExplorerService/V1/updateNotification?appid=SitemapWriter&url=');
            foreach ($services as $service) {
                http_download_file($service . urlencode(get_custom_base_url() . '/ocp_sitemap.xml'), NULL, false);
            }
        }
    }
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:34,代码来源:sitemap.php

示例2: get_future_version_information

/**
 * Get information about new versions of ocPortal (or more accurately, what's wrong with this version).
 *
 * @return tempcode		Information about the installed ocPortal version
 */
function get_future_version_information()
{
    require_lang('version');
    $url = 'http://ocportal.com/version.php?version=' . rawurlencode(ocp_version_full()) . '&lang=' . rawurlencode(user_lang());
    $data = http_download_file($url, NULL, false);
    if (!is_null($data)) {
        $data = str_replace('"../upgrader.php"', '"' . get_base_url() . '/upgrader.php"', $data);
        if ($GLOBALS['XSS_DETECT']) {
            ocp_mark_as_escaped($data);
        }
        require_code('character_sets');
        $data = convert_to_internal_encoding($data);
        $table = new ocp_tempcode();
        $lines = explode(chr(10), $data);
        foreach ($lines as $line) {
            if (trim($line) != '') {
                $table->attach(paragraph($line));
            }
        }
        $table = make_string_tempcode(preg_replace('#<p>\\s*</p>#', '', $table->evaluate()));
    } else {
        $table = paragraph(do_lang_tempcode('CANNOT_CONNECT_HOME'), 'dfsdff32ffd');
    }
    require_code('xhtml');
    /*$table->attach('<script type="text/javascript">// <![CDATA[
    		window.open(\''.$url.'\');
    	//]]></script>');*/
    return make_string_tempcode(xhtmlise_html($table->evaluate()));
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:34,代码来源:version2.php

示例3: retrieveGoogleSearch

 function retrieveGoogleSearch($searchTerms = "ocportal", $searchURL = "related:ocportal.com")
 {
     require_code('files');
     $googleBaseUrl = "http://ajax.googleapis.com/ajax/services/search/web";
     $googleBaseQuery = "?v=1.0&rsz=large&q=";
     $googleFullUrl = $googleBaseUrl . $googleBaseQuery . $searchURL . "%20" . $searchTerms;
     $returnGoogleSearch = http_download_file($googleFullUrl);
     $returnGoogleSearch = json_decode($returnGoogleSearch, true);
     return $returnGoogleSearch["responseData"]["results"];
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:10,代码来源:side_similar_sites.php

示例4: testAdminZone

 function testAdminZone()
 {
     if (function_exists('set_time_limit')) {
         @set_time_limit(0);
     }
     $result = http_download_file(get_base_url() . '/_tests/codechecker/phpdoc_parser.php', NULL, true, false, 'ocPortal', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 10000.0);
     foreach (explode('<br />', $result) as $line) {
         $this->assertTrue(trim($line) == '' || substr($line, 0, 4) == 'Done' || substr($line, 0, 6) == 'FINAL ' || strpos($line, 'TODO') !== false || strpos($line, 'HACKHACK') !== false, $line);
     }
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:10,代码来源:cqc__function_sigs.php

示例5: testDatabase

 function testDatabase()
 {
     if (function_exists('set_time_limit')) {
         @set_time_limit(0);
     }
     $result = http_download_file(get_base_url() . '/_tests/codechecker/code_quality.php?subdir=sources/database&api=1', NULL, true, false, 'ocPortal', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 10000.0);
     foreach (explode('<br />', $result) as $line) {
         $this->assertTrue(trim($line) == '' || substr($line, 0, 5) == 'SKIP:' || substr($line, 0, 5) == 'DONE ' || substr($line, 0, 6) == 'FINAL ' || strpos($line, 'TODO') !== false || strpos($line, 'HACKHACK') !== false, $line);
     }
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:10,代码来源:cqc_database.php

示例6: get_video_thumbnail

 /**
  * If we can handle this URL, get the thumbnail URL.
  *
  * @param  URLPATH		Video URL
  * @return ?string		The thumbnail URL (NULL: no match).
  */
 function get_video_thumbnail($src_url)
 {
     $matches = array();
     if (preg_match('#^http://www\\.facebook\\.com/video/video\\.php\\?v=(\\w+)#', $src_url, $matches) != 0) {
         require_code('files');
         $contents = http_download_file($src_url);
         if (preg_match('#addVariable\\("thumb_url", "([^"]*)"\\);#', $contents, $matches) != 0) {
             return rawurldecode(str_replace('\\u0025', '%', $matches[1]));
         }
     }
     return NULL;
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:18,代码来源:facebook.php

示例7: run

 /**
  * Standard modular run function for OcCLE hooks.
  *
  * @param  array	The options with which the command was called
  * @param  array	The parameters with which the command was called
  * @param  array	A reference to the OcCLE filesystem object
  * @return array	Array of stdcommand, stdhtml, stdout, and stderr responses
  */
 function run($options, $parameters, &$occle_fs)
 {
     if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
         return array('', do_command_help('feedback', array('h'), array(true)), '', '');
     } else {
         if (!array_key_exists(0, $parameters)) {
             return array('', '', '', do_lang('MISSING_PARAM', '1', 'feedback'));
         }
         $url = 'http://ocportal.com/pg/feedback';
         $post = array('title' => 'OcCLE feedback', 'post' => '(From "' . get_custom_base_url() . '" via OcCLE.)[quote]' . $parameters[0] . '[/quote]');
         http_download_file($url, NULL, true, true, 'ocPortal', $post);
         return array('', '', do_lang('SUCCESS'), '');
     }
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:22,代码来源:feedback.php

示例8: run

function run()
{
    $file = basename(rawurldecode($_GET['url']));
    //get old media file data
    $get_old_file = $GLOBALS['SITE_DB']->query('SELECT url FROM ' . get_table_prefix() . 'videos WHERE url LIKE "uploads/galleries/' . rawurlencode(basename(basename($file, '.m4v'), '.mp3')) . '%"');
    $type = 'galleries';
    if (!array_key_exists(0, $get_old_file)) {
        $get_old_file = $GLOBALS['SITE_DB']->query('SELECT a_url AS url FROM ' . get_table_prefix() . 'attachments WHERE a_url LIKE "uploads/attachments/' . rawurlencode(basename(basename($file, '.m4v'), '.mp3')) . '%"');
        $type = 'attachments';
        if (!array_key_exists(0, $get_old_file)) {
            $get_old_file = $GLOBALS['SITE_DB']->query('SELECT cv_value AS url FROM ' . get_table_prefix() . 'catalogue_efv_short WHERE cv_value LIKE "uploads/catalogues/' . rawurlencode(basename(basename($file, '.m4v'), '.mp3')) . '%"');
            $type = 'catalogues';
        }
    }
    require_code('files');
    $file_handle = @fopen(get_custom_file_base() . '/uploads/' . $type . '/' . $file, 'wb') or intelligent_write_error(get_custom_file_base() . '/uploads/' . $type . '/' . $file);
    http_download_file($_GET['url'], NULL, false, false, 'ocPortal', NULL, NULL, NULL, NULL, NULL, $file_handle, NULL, NULL, 6.0);
    fclose($file_handle);
    //move the old media file to the archive directory - '/uploads/'.$type.'/archive/'
    $new_url = 'uploads/' . $type . '/' . rawurlencode($file);
    if (isset($get_old_file[0]['url']) && is_string($get_old_file[0]['url']) && $get_old_file[0]['url'] != $new_url && strlen($get_old_file[0]['url']) > 0) {
        $movedir = dirname(str_replace('/uploads/' . $type . '/', '/uploads/' . $type . '_archive_addon/', str_replace('\\', '/', get_custom_file_base()) . '/' . rawurldecode($get_old_file[0]['url'])));
        @mkdir($movedir, 0777);
        require_code('files');
        fix_permissions($movedir, 0777);
        rename(str_replace('\\', '/', get_custom_file_base()) . '/' . rawurldecode($get_old_file[0]['url']), str_replace('/uploads/' . $type . '/', '/uploads/' . $type . '_archive_addon/', str_replace('\\', '/', get_custom_file_base()) . '/' . rawurldecode($get_old_file[0]['url'])));
    }
    switch ($type) {
        case 'galleries':
            $GLOBALS['SITE_DB']->query('UPDATE ' . get_table_prefix() . 'videos SET video_width=600,video_height=400,url="' . db_escape_string($new_url) . '" WHERE url LIKE "uploads/' . $type . '/' . db_escape_string(rawurlencode(basename(basename($file, '.m4v'), '.mp3'))) . '%"');
            // Replaces row that referenced $file without .m4v on the end (the original filename) with row that references the new $file we just copied
            break;
        case 'attachments':
            $GLOBALS['SITE_DB']->query('UPDATE ' . get_table_prefix() . 'attachments SET a_url="' . db_escape_string($new_url) . '" WHERE a_url LIKE "uploads/' . $type . '/' . db_escape_string(rawurlencode(basename(basename($file, '.m4v'), '.mp3'))) . '%"');
            // Replaces row that referenced $file without .m4v on the end (the original filename) with row that references the new $file we just copied
            break;
        case 'catalogues':
            $GLOBALS['SITE_DB']->query('UPDATE ' . get_table_prefix() . 'catalogue_efv_short SET cv_value="' . db_escape_string($new_url) . '" WHERE cv_value LIKE "uploads/' . $type . '/' . db_escape_string(rawurlencode(basename(basename($file, '.m4v'), '.mp3'))) . '%"');
            // Replaces row that referenced $file without .m4v on the end (the original filename) with row that references the new $file we just copied
            break;
    }
    $transcoding_server = get_option('transcoding_server', true);
    if (is_null($transcoding_server)) {
        //add option and default value
        add_config_option('TRANSCODING_SERVER', 'transcoding_server', 'line', 'return \'http://localhost/convertor\';', 'FEATURE', 'GALLERIES');
        $transcoding_server = get_option('transcoding_server', true);
    }
    file_get_contents($transcoding_server . '/move_to_sent.php?file=' . $_GET['url']);
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:49,代码来源:receive_transcoded_file.php

示例9: run

 /**
  * Standard modular run function.
  *
  * @param  array		A map of parameters.
  * @return tempcode	The result of execution.
  */
 function run($map)
 {
     unset($map);
     require_css('side_blocks');
     $netlinks = get_option('network_links');
     if (strlen($netlinks) > 0) {
         require_code('character_sets');
         $data = http_download_file($netlinks, NULL, false);
         if (is_null($data)) {
             $if_network = do_lang_tempcode('HTTP_DOWNLOAD_NO_SERVER', escape_html($netlinks));
         } else {
             $if_network = make_string_tempcode(convert_to_internal_encoding($data));
         }
         return do_template('BLOCK_SIDE_NETWORK', array('_GUID' => '5fe8867b9f69670ad61e6c78b956fab2', 'CONTENT' => $if_network));
     }
     return new ocp_tempcode();
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:23,代码来源:side_network.php

示例10: incoming_uploads_script

/**
 * Function to process the file upload process
 */
function incoming_uploads_script()
{
    $image_url_sub_for = get_param('image_url_sub_for', NULL);
    if ($image_url_sub_for !== NULL) {
        require_code('files');
        if (!url_is_local($image_url_sub_for) || strpos($image_url_sub_for, '/incoming/') !== false) {
            $url_to = 'uploads/website_specific/' . md5(uniqid('', true)) . '.png';
        } else {
            $url_to = dirname($image_url_sub_for) . '/' . md5(uniqid('', true)) . '.png';
        }
        $write_to_file = fopen($url_to, 'wb');
        http_download_file(either_param('imageurl'), NULL, true, false, 'ocPortal', NULL, NULL, NULL, NULL, NULL, $write_to_file);
        fclose($write_to_file);
        $GLOBALS['SITE_DB']->query_insert('image_url_sub_for', array('url_from' => $image_url_sub_for, 'url_to' => $url_to, 'member_id' => get_member(), 'expire' => time() + 60 * 60 * 24));
        exit;
    }
    non_overrided__incoming_uploads_script();
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:21,代码来源:incoming_uploads.php

示例11: xml_rpc

/**
 * Do a highly-simplified XML-RPC request (no actual calling supported - just messaging).
 *
 * @param  URLPATH	The XML-RPC call URL
 * @param  string		The method name to call.
 * @param  array		An array of parameters.
 * @param  boolean	Whether to accept failure.
 * @return ?string	The result (NULL: failed).
 */
function xml_rpc($url, $method, $params, $accept_failure = false)
{
    $rpc = "\n<" . "?xml version=\"1.0\"?" . ">\n<methodCall>\n <methodName>{$method}</methodName>\n <params>\n";
    foreach ($params as $_value) {
        $value = _xml_rpc_type_convert($_value);
        $rpc .= <<<END

\t  <param>
\t\t\t<value>{$value}</value>
\t  </param>
END;
    }
    $rpc .= <<<END

 </params>
</methodCall>
END;
    $result = http_download_file($url, NULL, true, false, 'ocPortal', array('_' => $rpc));
    return $result;
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:29,代码来源:xmlrpc.php

示例12: get_file

 /**
  * This will get the XML file from ocportal.com.
  *
  * @param  ?ID_TEXT		The ID to do under (NULL: root)
  * @return string			The XML file
  */
 function get_file($id)
 {
     $stub = get_param_integer('localhost', 0) == 1 ? get_base_url() : 'http://ocportal.com';
     $v = 'Version ' . float_to_raw_string(ocp_version_number(), 1);
     if (!is_null($id)) {
         $v = $id;
     }
     $url = $stub . '/data/ajax_tree.php?hook=choose_download&id=' . rawurlencode($v) . '&file_type=tar';
     require_code('character_sets');
     $contents = http_download_file($url);
     $utf = $GLOBALS['HTTP_CHARSET'] == 'utf-8';
     // We have to use 'U' in the regexp to work around a Chrome parser bug (we can't rely on convert_to_internal_encoding being 100% correct)
     require_code('character_sets');
     $contents = convert_to_internal_encoding($contents);
     $contents = preg_replace('#^\\s*\\<' . '\\?xml version="1.0" encoding="[^"]*"\\?' . '\\>\\<request\\>#' . ($utf ? 'U' : ''), '', $contents);
     $contents = preg_replace('#</request>#' . ($utf ? 'U' : ''), '', $contents);
     $contents = preg_replace('#<category [^>]*has_children="false"[^>]*>[^>]*</category>#' . ($utf ? 'U' : ''), '', $contents);
     $contents = preg_replace('#<category [^>]*title="Manual install required"[^>]*>[^>]*</category>#' . ($utf ? 'U' : ''), '', $contents);
     return $contents;
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:26,代码来源:choose_ocportalcom_addon.php

示例13: run

 /**
  * Standard modular run function.
  *
  * @param  array		A map of parameters.
  * @return tempcode	The result of execution.
  */
 function run($map)
 {
     require_lang('newsletter');
     require_lang('javascript');
     $newsletter_id = array_key_exists('param', $map) ? intval($map['param']) : db_get_first_id();
     $_newsletter_title = $GLOBALS['SITE_DB']->query_value_null_ok('newsletters', 'title', array('id' => $newsletter_id));
     if (is_null($_newsletter_title)) {
         return paragraph(do_lang_tempcode('MISSING_RESOURCE'));
     }
     $newsletter_title = get_translated_text($_newsletter_title);
     $address = post_param('address' . strval($newsletter_id), '');
     if ($address != '') {
         require_code('newsletter');
         require_code('type_validation');
         if (!is_valid_email_address($address)) {
             $msg = do_template('INLINE_WIP_MESSAGE', array('MESSAGE' => do_lang_tempcode('INVALID_EMAIL_ADDRESS')));
             return do_template('BLOCK_MAIN_NEWSLETTER_SIGNUP', array('URL' => get_self_url(), 'MSG' => $msg));
         }
         if (!array_key_exists('path', $map)) {
             $map['path'] = 'uploads/website_specific/signup.txt';
         }
         require_code('character_sets');
         $password = basic_newsletter_join($address, 4, NULL, !file_exists(get_custom_file_base() . '/' . $map['path']), $newsletter_id, post_param('firstname' . strval($newsletter_id), ''), post_param('lastname' . strval($newsletter_id), ''));
         if ($password == '') {
             return do_template('INLINE_WIP_MESSAGE', array('MESSAGE' => do_lang_tempcode('NEWSLETTER_THIS_ALSO')));
         }
         if ($password == do_lang('NA')) {
             $manage_url = build_url(array('page' => 'newsletter', 'email' => $address), get_module_zone('newsletter'));
             return do_template('INLINE_WIP_MESSAGE', array('MESSAGE' => do_lang_tempcode('ALREADY_EMAIL_ADDRESS', escape_html($manage_url->evaluate()))));
         }
         require_code('mail');
         if (file_exists(get_custom_file_base() . '/' . $map['path'])) {
             $url = (url_is_local($map['path']) ? get_custom_base_url() . '/' : '') . $map['path'];
             mail_wrap(array_key_exists('subject', $map) ? $map['subject'] : do_lang('WELCOME'), convert_to_internal_encoding(http_download_file($url)), array($address), array_key_exists('to', $map) ? $map['to'] : '', '', '', 3, NULL, false, NULL, true);
         }
         return do_template('BLOCK_MAIN_NEWSLETTER_SIGNUP_DONE', array('_GUID' => '9953c83685df4970de8f23fcd5dd15bb', 'NEWSLETTER_TITLE' => $newsletter_title, 'NID' => strval($newsletter_id), 'PASSWORD' => $password));
     } else {
         return do_template('BLOCK_MAIN_NEWSLETTER_SIGNUP', array('NEWSLETTER_TITLE' => $newsletter_title, 'NID' => strval($newsletter_id), 'URL' => get_self_url()));
     }
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:46,代码来源:main_newsletter_signup.php

示例14: run

 /**
  * Standard modular run function for OcCLE hooks.
  *
  * @param  array	The options with which the command was called
  * @param  array	The parameters with which the command was called
  * @param  array	A reference to the OcCLE filesystem object
  * @return array	Array of stdcommand, stdhtml, stdout, and stderr responses
  */
 function run($options, $parameters, &$occle_fs)
 {
     if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
         return array('', do_command_help('occlechat', array('h'), array(true, true)), '', '');
     } else {
         if (!array_key_exists(0, $parameters)) {
             return array('', '', '', do_lang('MISSING_PARAM', '1', 'occlechat'));
         }
         if (!array_key_exists(1, $parameters)) {
             return array('', '', '', do_lang('MISSING_PARAM', '2', 'occlechat'));
         }
         $GLOBALS['SITE_DB']->query_insert('occlechat', array('c_message' => $parameters[1], 'c_url' => $parameters[0], 'c_incoming' => 0, 'c_timestamp' => time()));
         $url = $parameters[0] . '/data/occle.php?action=message&base_url=' . urlencode(get_base_url()) . '&message=' . urlencode($parameters[1]);
         $return = http_download_file($url, NULL, false);
         if (is_null($return)) {
             return array('', '', '', do_lang('HTTP_DOWNLOAD_NO_SERVER', $parameters[0]));
         } elseif ($return == '1') {
             return array('', '', do_lang('SUCCESS'), '');
         } else {
             return array('', '', '', do_lang('INCOMPLETE_ERROR'));
         }
     }
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:31,代码来源:occlechat.php

示例15: run

 /**
  * Standard modular run function for OcCLE hooks.
  *
  * @param  array	The options with which the command was called
  * @param  array	The parameters with which the command was called
  * @param  array	A reference to the OcCLE filesystem object
  * @return array	Array of stdcommand, stdhtml, stdout, and stderr responses
  */
 function run($options, $parameters, &$occle_fs)
 {
     require_code('xhtml');
     if (array_key_exists('h', $options) || array_key_exists('help', $options)) {
         return array('', do_command_help('fix_perms', array('h'), array(true, true, true)), '', '');
     } else {
         if (!array_key_exists(0, $parameters)) {
             return array('', '', '', do_lang('MISSING_PARAM', '1', 'fix_perms'));
         }
         if (!array_key_exists(1, $parameters)) {
             return array('', '', '', do_lang('MISSING_PARAM', '2', 'fix_perms'));
         }
         if (!array_key_exists(2, $parameters)) {
             return array('', '', '', do_lang('MISSING_PARAM', '3', 'fix_perms'));
         }
         $return = http_download_file(get_base_url() . '/upgrader.php?check_perms=1&user=' . $parameters[0] . '&pass=' . $parameters[1] . '&root=' . $parameters[2], NULL, false);
         if (is_null($return)) {
             return array('', '', '', do_lang('HTTP_DOWNLOAD_NO_SERVER', get_base_url() . '/upgrader.php?check_perms=1'));
         } else {
             return array('', occle_make_normal_html_visible(extract_html_body($return)), '', '');
         }
     }
 }
开发者ID:erico-deh,项目名称:ocPortal,代码行数:31,代码来源:fix_perms.php


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