imho.ws
IMHO.WS  

Вернуться   IMHO.WS > Веб-мастеру > Веб-программирование
Опции темы
Старый 10.10.2005, 06:08     # 1
slama
Guest
 
Сообщения: n/a

RSS

Кто знает почему скрипт для вывода на web страницу на локалхосте отлично работает а на h15 пишет ошибку?


Скрипт:
<?


class rss{

var $sUrl;
var $sBuff;
var $rXml_parser;
var $aParentField;
var $aCurrrentField;
var $aCurrentNamespace;
var $aRss;
var $aItems;
var $aChannel;

function rss($url=""){
if(!isset($url) || empty($url)){
echo "no RSS url";
exit();
}

$this->aChannel = array();
$this->aItems = array();
$this->aRss = array($this->aChannel, $this->aItems);
$this->aParentField = array();
$this->xml_parser = undef;
$this->sUrl = strval($url);

$this->GetUrl();

$this->ParseRss();
}

function GetUrl(){
$this->sBuff = join ("", file($this->sUrl));

}

function ParseRss(){
$this->rXml_parser = xml_parser_create();
xml_set_object($this->rXml_parser, &$this);
xml_set_element_handler($this->rXml_parser, "starttag", "endtag");
xml_set_character_data_handler($this->rXml_parser, "cdata");
if (!xml_parse($this->rXml_parser, $this->sBuff)) {
die(sprintf("XML error: %s at line %d",
xml_error_string(xml_get_error_code($this->rXml_parser)),
xml_get_current_line_number($this->rXml_parser))
);
}
xml_parser_free($this->rXml_parser);
$this->aRss = array("channel" => $this->aChannel, "items" => $this->aItems);
}

function GetArrayRss(){
return $this->aRss;
}


function GetChannelVal($sVal){
return $this->aChannel[$sVal];
}

function GetArrayChannel(){
return $this->aChannel;
}

function GetArrayItem(){
return $this->aItems;
}

function starttag($rXml_parser, $tag, $attributes){
$tag = strtolower( $tag );
$namespace = false;
if ( strpos( $tag, ':' ) ) {
list($namespace, $tag) = split( ':', $tag, 2);
}
$this->aCurrrentField = $tag;
if ( $namespace and $namespace != 'rdf' ) {
$this->aCurrentNamespace = $namespace;
}
if ( $tag == 'channel' ) {
array_unshift( $this->aParentField, 'channel' );
}elseif ( $tag == 'items' ) {
array_unshift( $this->aParentField, 'items' );
}elseif ( $tag == 'item' ){
array_unshift( $this->aParentField, 'item' );
}elseif ( $tag == 'cdatainput' ) {
array_unshift( $this->aParentField, 'cdatainput' );
}elseif ( $tag == 'image' ) {
array_unshift( $this->aParentField, 'image' );
}
}

function endtag($rXml_parser, $tag){
$tag = strtolower($tag);
if ( $tag == 'item' ) {
$this->aItems[] = $this->current_item;
$this->current_item = array();
array_shift( $this->aParentField );
}elseif ( $tag == 'channel' or $tag == 'items' or $tag == 'cdatainput' or $tag == 'image' ) {
array_shift( $this->aParentField );
}
$this->aCurrrentField = '';
$this->aCurrentNamespace = false;
}

function cdata($rXml_parser, $cdata){
if ( $this->aParentField[0] == $this->aCurrrentField || !$this->aCurrrentField ){
return;
}elseif ( $this->aParentField[0] == 'channel') {
if ( $this->aCurrentNamespace ) {
$this->aChannel[ $this->aCurrentNamespace ][ $this->aCurrrentField ] .= $cdata;
}else{
$this->aChannel[ $this->aCurrrentField ] .= $cdata;
}
}elseif ( $this->aParentField[0] == 'item' ){
if ( $this->aCurrentNamespace ) {
$this->current_item[ $this->aCurrentNamespace ][ $this->aCurrrentField ] .= $cdata;
}else{
$this->current_item[ $this->aCurrrentField ] .= $cdata;
}
}elseif ( $this->aParentField[0] == 'cdatainput' ) {
if ( $this->aCurrentNamespace ) {
$this->cdatainput[ $this->aCurrentNamespace ][ $this->aCurrrentField ] .= $cdata;
}else{
$this->cdatainput[ $this->aCurrrentField ] .= $cdata;
}
}elseif ( $this->aParentField[0] == 'image' ) {
if ( $this->aCurrentNamespace ) {
$this->image[ $this->aCurrentNamespace ][ $this->aCurrrentField ] .= $cdata;
}else{
$this->image[ $this->aCurrrentField ] .= $cdata;
}
}
}
}
?>


Вывожу так:

<?
require("./rss.php");

$rssurl = "http://www.flashmaster.ru/rss2.php";

$cRss = new rss($rssurl);
?>
<html>
<head>

<title><?= $cRss->GetChannelVal("title"); ?></title>
</head>
<body>
<h1><?= $cRss->GetChannelVal("title"); ?></h1>
<p><b>Channel title: </b><?= $cRss->GetChannelVal("title"); ?></p>
<p><b>Channel description: </b><?= $cRss->GetChannelVal("description"); ?></p>
<p><b>Channel link: </b><?= $cRss->GetChannelVal("link"); ?></p>
<p><b>Channel pubdate: </b><?= $cRss->GetChannelVal("pubdate"); ?></p>
<hr>
<?
foreach($cRss->GetArrayItem() as $item) {
echo "<p><b>Item title:</b>".$item['title']."</p>";
echo "<p><b>Item description:</b>".$item['description']."</p>";
echo "<p><b>Item author:</b>".$item['author']."</p>";
echo "<p><b>Item pubdate:</b>".$item['pubdate']."</p>";
echo "<p><b>Item link:</b>".$item['link']."</p>";
echo "<hr>";
}
?>
</body>
</html>


ошибка собственно :
Warning: file(http://www.flashmaster.ru/rss2.php): failed to open stream: Permission denied in /home/h/hvnews.h15.ru/WWW/rss/rss.php on line 35

Warning: join(): Bad arguments. in /home/h/hvnews.h15.ru/WWW/rss/rss.php on line 35

Последний раз редактировалось slama; 10.10.2005 в 06:28.
 
Старый 10.10.2005, 14:04     # 2
Naked
::VIP::
 
Аватар для Naked
 
Регистрация: 15.05.2005
Адрес: Питер
Сообщения: 1 194

Naked СэнсэйNaked СэнсэйNaked СэнсэйNaked СэнсэйNaked СэнсэйNaked СэнсэйNaked СэнсэйNaked СэнсэйNaked СэнсэйNaked СэнсэйNaked СэнсэйNaked СэнсэйNaked СэнсэйNaked Сэнсэй
Цитата:
ВНИМАНИЕ!Работа исходящих коннектов от Ваших скриптов с сервера запрещена. Проще говоря, они просто не будут работать. Например, если ваш скрипт пытается работать с процедурой "whois", то у него ничего не выйдет. Примите эту информацию к сведению
Это в правилах holm'а... А http://www.flashmaster.ru/rss2.php - исходящий коннект, насколько я понимаю, поэтому и не работает...
__________________
Чтобы воля стала действующим началом, тело должно быть совершенным.
Naked вне форума  
Старый 10.10.2005, 20:31     # 3
slama
Guest
 
Сообщения: n/a

Печально =(
Спасибо за помощь The_naked
Полезный форум
 
Старый 10.10.2005, 20:38     # 4
Naked
::VIP::
 
Аватар для Naked
 
Регистрация: 15.05.2005
Адрес: Питер
Сообщения: 1 194

Naked СэнсэйNaked СэнсэйNaked СэнсэйNaked СэнсэйNaked СэнсэйNaked СэнсэйNaked СэнсэйNaked СэнсэйNaked СэнсэйNaked СэнсэйNaked СэнсэйNaked СэнсэйNaked СэнсэйNaked Сэнсэй
slama
По-моему на fatal.ru есть возможность исходящих запросов, а вообще - зайди в раздел Хостинг, там в бесплатном хостинге может что-нибудь и найдешь... - Вот здесь
__________________
Чтобы воля стала действующим началом, тело должно быть совершенным.
Naked вне форума  
Старый 14.10.2005, 21:55     # 5
slama
Guest
 
Сообщения: n/a

Спасибо товарищ) А что там насчёт онлайн игры?)
 


Ваши права в разделе
Вы НЕ можете создавать новые темы
Вы не можете отвечать в темах.
Вы НЕ можете прикреплять вложения
Вы НЕ можете редактировать свои сообщения

BB код Вкл.
Смайлы Вкл.
[IMG] код Выкл.
HTML код Выкл.

Быстрый переход


Часовой пояс GMT +4, время: 03:01.




Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.