[ Поиск ] - [ Пользователи ] - [ Календарь ]
Полная Версия: Как изменить функцию file_get_contents на cURL
Max1
Помогите новичку

Здравствуйте!
Как заменить функцию file_get_contents на cURL.
Так понял самый популярный способ этот:
function file_get_contents_curl($url) {
$ch = curl_init();

curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //Set curl to return the data instead of printing it to the browser.
curl_setopt($ch, CURLOPT_URL, $url);

$data = curl_exec($ch);
curl_close($ch);

return $data;
}

Но где все это дело прописывать?
С текстом file_get_contents на моем сайте нашлось около 40 файлов и везде все по разному.

user posted image
walerus
Цитата
С текстом file_get_contents на моем сайте нашлось около 40 файлов и везде все по разному.
, в этом форуме преобладают пользователи со способностями "ясновидящих"... пример привести трудно было...

Было бы не плохо почитать про назначения функций...
file_get_contents -- Получить содержимое файла в виде одной строки, так же - "Для этой функции вы можете использовать URL в качестве имени файла"... По этому, нужно смотреть конкретное место вызова этой функции, что бы понять, для чего она там применяется...
Max1
Спасибо за ответ! Посоветуйте где почитать.
Вот, я так понимаю данные места (сразу не стал прикреплять, т.к. не был уверен в надобности):
...templates/jb_grid2/css/css.php:                $content .= file_get_contents($file);
...templates/system/error.php:<?php defined('JPATH_BASE') or die();echo file_get_contents(JURI::root().'index.php? ption=com_content&view=article&id=12');?>
...templates/zengridframework/css/css.php: $content .= file_get_contents($file);
...modules/mod_captifyContent/image.php: $data = file_get_contents($docRoot . '/' . $image);
...modules/mod_captifyContent/image.php: $data = file_get_contents($resized);
...modules/mod_captifyContent/includes/helper.php: //$siTemp = imagecreatefromstring(file_get_contents($url));
...modules/mod_captifyContent/includes/helper.php: //$fetchXML = file_get_contents('http://twitter.com/statuses/user_timeline.xml?screen_name='.$twitterUser name);
...modules/mod_captifyContent/includes/helper.php: //$twitterXML = new SimpleXMLElement(file_get_contents($twitterXMLFile));
...modules/mod_slideshow3/image.php: $data = file_get_contents($docRoot . '/' . $image);
...modules/mod_slideshow3/image.php: $data = file_get_contents($resized);
...modules/mod_slideshow3/includes/helper.php: //$siTemp = imagecreatefromstring(file_get_contents($url));
...modules/mod_slideshow3/includes/helper.php: //$fetchXML = file_get_contents('http://twitter.com/statuses/user_timeline.xml?screen_name='.$twitterUser name);
...modules/mod_slideshow3/includes/helper.php: //$twitterXML = new SimpleXMLElement(file_get_contents($twitterXMLFile));
...libraries/openid/Auth/OpenID.php: $str = file_get_contents('php://input');
...libraries/phpxmlrpc/xmlrpcs.php: $data = file_get_contents('php://input');
...libraries/phpxmlrpc/xmlrpcs.php: $data = isset($GLOBALS['HTTP_RAW_POST_DATA']) ? $GLOBALS['HTTP_RAW_POST_DATA'] : @file_get_contents('php://input');
...libraries/domit/xml_domit_rss_shared.php: if (function_exists('file_get_contents')) {
...libraries/domit/xml_domit_rss_shared.php: $fileContents = @file_get_contents($filename);
...libraries/domit/xml_domit_lite_parser.php: else if (function_exists('file_get_contents')) {
...libraries/domit/xml_domit_lite_parser.php: return file_get_contents($filename);
...libraries/domit/xml_domit_parser.php: else if (function_exists('file_get_contents')) {
...libraries/domit/xml_domit_parser.php: return file_get_contents($filename);
...libraries/domit/php_text_cache.php: if (function_exists('file_get_contents')) {
...libraries/domit/php_text_cache.php: return @file_get_contents($filename);
...libraries/simplepie/simplepie.php: * file_get_contents() file source
...libraries/simplepie/simplepie.php: if (!$this->body = file_get_contents($url))
...libraries/simplepie/simplepie.php: $this->error = 'file_get_contents could not read the file';
...libraries/simplepie/simplepie.php: return unserialize(file_get_contents($this->name));
...libraries/simplepie/idn/idna_convert.class.php: if (function_exists('file_get_contents')) {
...libraries/simplepie/idn/idna_convert.class.php: $this->NP = unserialize(file_get_contents(dirname(__FILE__).'/npdata.ser'));
...libraries/geshi/geshi/php-brief.php: 'ereg', 'ereg_replace', 'eregi', 'eregi_replace', 'split', 'spliti', 'join', 'sql_regcase', 'dl', 'pclose', 'popen', 'readfile', 'rewind', 'rmdir', 'umask', 'fclose', 'feof', 'fgetc', 'fgets', 'fgetss', 'fread', 'fopen', 'fpassthru', 'ftruncate', 'fstat', 'fseek', 'ftell', 'fflush', 'fwrite', 'fputs', 'mkdir', 'rename', 'copy', 'tempnam', 'tmpfile', 'file', 'file_get_contents', 'stream_select', 'stream_context_create', 'stream_context_set_params', 'stream_context_set_option', 'stream_context_get_options', 'stream_filter_prepend', 'stream_filter_append', 'fgetcsv', 'flock', 'get_meta_tags', 'stream_set_write_buffer', 'set_file_buffer', 'set_socket_blocking', 'stream_set_blocking', 'socket_set_blocking', 'stream_get_meta_data', 'stream_register_wrapper', 'stream_wrapper_register', 'stream_set_timeout', 'socket_set_timeout', 'socket_get_status', 'realpath', 'fnmatch', 'fsockopen', 'pfsockopen', 'pack', 'unpack', 'get_browser', 'crypt', 'opendir', 'closedir', 'chdir', 'getcwd', 'rewinddir', 'readdir', 'dir', 'glob', 'fileatime', 'filectime', 'filegroup', 'fileinode', 'filemtime', 'fileowner', 'fileperms', 'filesize', 'filetype', 'file_exists', 'is_writable', 'is_writeable', 'is_readable', 'is_executable', 'is_file', 'is_dir', 'is_link', 'stat', 'lstat', 'chown',
...libraries/geshi/geshi/php.php: 'file_get_contents','file_put_contents','fileatime','filectime',
...libraries/geshi/geshi.php: if (false === ($data = file_get_contents($fullpath))) {
...libraries/geshi/geshi.php: $this->set_source(file_get_contents($file_name));
...libraries/joomla/language/language.php: if ($content = @file_get_contents( $filename ))
...libraries/joomla/language/language.php: if ($content = file_get_contents($dir.DS.$file)) {
...libraries/joomla/language/help.php: $data = file_get_contents($pathToXml);
...libraries/joomla/utilities/simplexml.php: $xml = trim( file_get_contents($path) );
...libraries/joomla/installer/installer.php: $buffer = file_get_contents($this->getPath('extension_administrator').DS.$sqlfile);
...libraries/joomla/document/html/html.php: $content = file_get_contents($directory.DS.$template.DS.'params.ini');
...libraries/joomla/cache/storage/file.php: $data = file_get_contents($path);
...libraries/joomla/cache/storage/file.php: if ($written && ($data == file_get_contents($path))) {
...libraries/joomla/cache/storage/file.php: $time = @file_get_contents($file);
...libraries/joomla/cache/storage/file.php: $time = @file_get_contents($path.'_expire');
...libraries/pattemplate/patTemplate/OutputFilter/PdfLatex.php: $pdf = file_get_contents($pdf);
...libraries/pattemplate/patTemplate/TemplateCache/File.php: return unserialize(file_get_contents($filename));
...libraries/pattemplate/patTemplate/TemplateCache/File.php: return unserialize( file_get_contents( $filename ) );
...libraries/pattemplate/patTemplate/Reader/IT.php: if( function_exists( 'file_get_contents' ) )
...libraries/pattemplate/patTemplate/Reader/IT.php: $content = @file_get_contents( $file );
...libraries/pattemplate/patTemplate/Reader/File.php: if (function_exists('file_get_contents')) {
...libraries/pattemplate/patTemplate/Reader/File.php: $content = @file_get_contents( $file );
...libraries/tcpdf/tcpdf.php: $this->_putstream(file_get_contents($ctgfile));
...administrator/components/com_admin/admin.admin.html.php: $buffer = file_get_contents( JPATH_BASE.DS.'help'.DS.$langTag.DS.$file );
...administrator/components/com_config/controllers/application.php: if (($data = file_get_contents('http://help.joomla.org/helpsites-15.xml')) === false ) {
...administrator/templates/system/error.php:<?php defined('JPATH_BASE') or die();echo file_get_contents(JURI::root().'index.php? ption=com_content&view=article&id=12');?>
...plugins/editors/tinymce/jscripts/tiny_mce/tiny_mce_gzip.php: if (function_exists("file_get_contents"))
...plugins/editors/tinymce/jscripts/tiny_mce/tiny_mce_gzip.php: return @file_get_contents($path);
...plugins/editors/xstandard/directory.php: return @file_get_contents($path);

Быстрый ответ:

 Графические смайлики |  Показывать подпись
Здесь расположена полная версия этой страницы.
Invision Power Board © 2001-2024 Invision Power Services, Inc.