• DONATE to NULLED!
    Форуму и его команде можно помочь, мотивировать модераторов разделов.
    Помогите модератору этого раздела killoff лично.

Помощь Грабер для Gismeteo

Статус
В этой теме нельзя размещать новые ответы.

cheburdoser

Создатель
Регистрация
28 Июн 2010
Сообщения
30
Реакции
1
Нужна помощь по скрипту грабера для гисметео.

Почемуто не работает может что тут не так прописано.

скрипт самого грабер

<?php

include ("engine/system_config/config_weather.php");

//Погода сейчас
$textrr = file_get_contents("http://gismeteo.ua/city/hourly/".$idcity2."/#tab_0");

$textr = str_replace('<img src="/images/ico/wind/', '<img src="templates/m3-reborn/fastheme/images/weather/', $textrr);
$textz = str_replace('class="c12">', 'style="padding: 5px;5px;5px;5px; background: none;">', $textr);
$textzz = str_replace('class="c3">', 'style="padding: 5px;5px;5px;5px; background: none;">', $textz);
$textzzz = str_replace('class="c4">', 'style="padding: 5px;5px;5px;5px; background: none;">', $textzz);
$textzzzz = str_replace('class="c5">', 'style="padding: 5px;5px;5px;5px; background: none;">', $textzzz);
$textzzzzz = str_replace('class="c6">', 'style="padding: 5px;5px;5px;5px; background: none;">', $textzzzz);
$textzzzzzz = str_replace('class="c7">', 'style="padding: 5px;5px;5px;5px; background: none;">', $textzzzzz);
$textzzzzzzz = str_replace('<tr class="head lines">', '<tr style="font-size: 12px;font-style:bold;">', $textzzzzzz);
$textzzzzzzzz = str_replace('<tr class="decor First"><td colspan="8">.</td></tr>', '', $textzzzzzzz);
$textzzzzzzzzz = str_replace('<tr class="decor Last"><td colspan="8">.</td></tr>', '', $textzzzzzzzz);
$text = str_replace('<img class="png" src="http://i.gismeteo.com/images/icons/new/', '<img class="png" src="templates/m3-reborn/fastheme/images/weather/', $textzzzzzzzzz);

// Ищем начало вхождения таблицы
$pos_begin = strpos($text, '<tbody class="tabsTable tab_0 select" >');
$text = substr($text,$pos_begin);
// Ищем конец таблицы
$pos_end = strpos($text,'<tbody class="tabsTable tab_2" >');
$pogoda = substr($text, 0, $pos_end + 0);
if(file_exists("uploads/pogoda/weathernow.html"))
{
unlink("uploads/pogoda/weathernow.html");
}
$f=fopen("uploads/pogoda/weathernow.html","a");
fwrite($f, iconv("UTF-8", "WINDOWS-1251", $pogoda));


//Погода на пару дней
$textrr = file_get_contents("http://gismeteo.ua/city/hourly/".$idcity2."/2/");

$textr = str_replace('<img src="/images/ico/wind/', '<img src="{THEME}/fastheme/images/weather/', $textrr);
$textz = str_replace('class="c12">', 'style="padding: 5px;5px;5px;5px; background: none;">', $textr);
$textzz = str_replace('class="c3">', 'style="padding: 5px;5px;5px;5px; background: none;">', $textz);
$textzzz = str_replace('class="c4">', 'style="padding: 5px;5px;5px;5px; background: none;">', $textzz);
$textzzzz = str_replace('class="c5">', 'style="padding: 5px;5px;5px;5px; background: none;">', $textzzz);
$textzzzzz = str_replace('class="c6">', 'style="padding: 5px;5px;5px;5px; background: none;">', $textzzzz);
$textzzzzzz = str_replace('class="c7">', 'style="padding: 5px;5px;5px;5px; background: none;">', $textzzzzz);
$textzzzzzzz = str_replace('<tr class="head lines">', '<tr style="font-size: 12px;font-style:bold;">', $textzzzzzz);
$textzzzzzzzz = str_replace('<tr class="decor First"><td colspan="8">.</td></tr>', '', $textzzzzzzz);
$textzzzzzzzzz = str_replace('<tr class="decor Last"><td colspan="8">.</td></tr>', '', $textzzzzzzzz);
$text = str_replace('<img class="png" src="http://i.gismeteo.com/images/icons/new/', '<img class="png" src="{THEME}/fastheme/images/weather/', $textzzzzzzzzz);


// Ищем начало вхождения таблицы
$pos_begin = strpos($text,'<tbody class="tabsTable tab_0 select" >');
$text = substr($text,$pos_begin);
// Ищем конец таблицы
$pos_end = strpos($text,'</table>


</div></div>
');
$pogoda2 .= substr($text, 0, $pos_end + 0);
if(file_exists("uploads/pogoda/weather.html"))
{
unlink("uploads/pogoda/weather.html");
}
$f=fopen("uploads/pogoda/weather.html","a");
fwrite($f, iconv("UTF-8", "WINDOWS-1251", $pogoda2));

//погода на 3 дня
$textrr = file_get_contents("http://gismeteo.ua/city/hourly/".$idcity2."/4/");

$textr = str_replace('<img src="/images/ico/wind/', '<img src="{THEME}/fastheme/images/weather/', $textrr);
$textz = str_replace('class="c12">', 'style="padding: 5px;5px;5px;5px; background: none;">', $textr);
$textzz = str_replace('class="c3">', 'style="padding: 5px;5px;5px;5px; background: none;">', $textz);
$textzzz = str_replace('class="c4">', 'style="padding: 5px;5px;5px;5px; background: none;">', $textzz);
$textzzzz = str_replace('class="c5">', 'style="padding: 5px;5px;5px;5px; background: none;">', $textzzz);
$textzzzzz = str_replace('class="c6">', 'style="padding: 5px;5px;5px;5px; background: none;">', $textzzzz);
$textzzzzzz = str_replace('class="c7">', 'style="padding: 5px;5px;5px;5px; background: none;">', $textzzzzz);
$textzzzzzzz = str_replace('<tr class="head lines">', '<tr style="font-size: 12px;font-style:bold;">', $textzzzzzz);
$textzzzzzzzz = str_replace('<tr class="decor First"><td colspan="8">.</td></tr>', '', $textzzzzzzz);
$textzzzzzzzzz = str_replace('<tr class="decor Last"><td colspan="8">.</td></tr>', '', $textzzzzzzzz);
$text = str_replace('<img class="png" src="http://i.gismeteo.com/images/icons/new/', '<img class="png" src="{THEME}/fastheme/images/weather/', $textzzzzzzzzz);


// Ищем начало вхождения таблицы
$pos_begin = strpos($text,'<tbody class="tabsTable tab_0 select" >');
$text = substr($text,$pos_begin);
// Ищем конец таблицы
$pos_end = strpos($text,'</table>


</div></div>
');
$pogoda3 .= substr($text, 0, $pos_end + 0);
if(file_exists("uploads/pogoda/weather3.html"))
{
unlink("uploads/pogoda/weather3.html");
}
$f=fopen("uploads/pogoda/weather3.html","a");
fwrite($f, iconv("UTF-8", "WINDOWS-1251", $pogoda3));


//погода на 7 дней
$textrr = file_get_contents("http://gismeteo.ua/city/weekly/".$idcity2."/");

$textr = str_replace('<img src="/images/ico/wind/', '<img src="{THEME}/fastheme/images/weather/', $textrr);
$textz = str_replace('class="c12">', 'style="padding: 5px;5px;5px;5px; background: none;">', $textr);
$textzz = str_replace('class="c3">', 'style="padding: 5px;5px;5px;5px; background: none;">', $textz);
$textzzz = str_replace('class="c4">', 'style="padding: 5px;5px;5px;5px; background: none;">', $textzz);
$textzzzz = str_replace('class="c5">', 'style="padding: 5px;5px;5px;5px; background: none;">', $textzzz);
$textzzzzz = str_replace('class="c6">', 'style="padding: 5px;5px;5px;5px; background: none;">', $textzzzz);
$textzzzzzz = str_replace('class="c7">', 'style="padding: 5px;5px;5px;5px; background: none;">', $textzzzzz);
$textzzzzzzz = str_replace('<tr class="head lines workday">', '<tr style="font-size: 12px;font-style:bold;">', $textzzzzzz);
$textzzzzzzzz = str_replace('<tr class="decor First"><td colspan="8">.</td></tr>', '', $textzzzzzzz);
$textzzzzzzzzz = str_replace('<tr class="decor Last"><td colspan="8">.</td></tr>', '', $textzzzzzzzz);
$textzzzzzzzzzz = str_replace('<td class="c0 day">', '<td style="font-size: 12px;font-color:#469BD3; color:#469BD3;">', $textzzzzzzzzz);
$text = str_replace('<img class="png" src="http://i.gismeteo.com/images/icons/new/', '<img class="png" src="{THEME}/fastheme/images/weather/', $textzzzzzzzzzz);


// Ищем начало вхождения таблицы
$pos_begin = strpos($text,'<div class="full">');
$text = substr($text,$pos_begin);
// Ищем конец таблицы
$pos_end = strpos($text,'</table>


</div></div>
');
$pogoda4 .= substr($text, 0, $pos_end + 0);
if(file_exists("uploads/pogoda/weather5.html"))
{
unlink("uploads/pogoda/weather5.html");
}
$f=fopen("uploads/pogoda/weather5.html","a");
fwrite($f, iconv("UTF-8", "WINDOWS-1251", $pogoda4));
?>

скрипт обработчика

<?php
require_once ROOT_DIR.'/engine/modules/content/weather/pogodaload.php';
require_once ROOT_DIR.'/engine/system_config/config_weather.php';

$navigation = '<DIV align="center" class=t2 style="MARGIN: 10px 10px" >
<a href="/pogoda/" style="text-decoration: none"><b>Погода сейчас</b></a>&nbsp;&nbsp;&nbsp;
<a href="/pogoda/3/" style="text-decoration: none"><b>3-5 дней</b></a>&nbsp;&nbsp;&nbsp;
<a href="/pogoda/5/" style="text-decoration: none"><b>5-7 дней</b></a>&nbsp;&nbsp;&nbsp;
<a href="/pogoda/10/" style="text-decoration: none"><b>На 2 недели</b></a>&nbsp;&nbsp;&nbsp;
</DIV>';

if($action == "") {
$tpl->load_template('pogoda.tpl');
$pogoda_title .= $title;
$pogoda_contents .= $navigation;
$pogoda_contents2 = file_get_contents("./uploads/pogoda/weathernow.html");
$tpl->set('{namep}',$namecitys);
$tpl->set('{hpogoda}',$pogoda_contents);
$tpl->set('{bpogoda}',$pogoda_contents2);
$tpl->compile('content');
$tpl->clear();
}elseif($action == "3day"){
$tpl->load_template('pogoda.tpl');
$pogoda_contents .= $navigation;
$pogoda_contents2 = file_get_contents("./uploads/pogoda/weather.html");
$tpl->set('{namep}',$namecitys);
$tpl->set('{hpogoda}',$pogoda_contents);
$tpl->set('{bpogoda}',$pogoda_contents2);
$tpl->compile('content');
$tpl->clear();
}elseif($action == "5day"){
$tpl->load_template('pogoda.tpl');
$pogoda_contents .= $navigation;
$pogoda_contents2 = file_get_contents("./uploads/pogoda/weather3.html");
$tpl->set('{namep}',$namecitys);
$tpl->set('{hpogoda}',$pogoda_contents);
$tpl->set('{bpogoda}',$pogoda_contents2);
$tpl->compile('content');
$tpl->clear();
}elseif($action == "10day"){
$tpl->load_template('pogoda.tpl');
$pogoda_contents .= $navigation;
$pogoda_contents2 = file_get_contents("./uploads/pogoda/weather5.html");
$tpl->set('{namep}',$namecitys);
$tpl->set('{hpogoda}',$pogoda_contents);
$tpl->set('{bpogoda}',$pogoda_contents2);
$tpl->compile('content');
$tpl->clear();
}
?>

шаблон

<div id="cat-title">
<h2>{namep}</h2>
</div>

<br>
{hpogoda}<br>
<div style='align:center;padding:0px 0px 0px 0px;margin-bottom:0px;border:solid #469BD3 1px;'>
<div style='padding:0 12px;background: url(Для просмотра ссылки Войди или Зарегистрируйся) repeat-x;'>
<table height:100% align=center width=100%>
{bpogoda}
</table>
</div>
</div>

Даный скрипт должен по идеи вытягивать погоду из страницы

_http://www.gismeteo.ua/city/daily/4944/
 
что у тебя в файле config_weather.php прописано? покажи...
Точно есть сойденение сайта с интернетом?
 
что у тебя в файле config_weather.php прописано? покажи...
Точно есть сойденение сайта с интернетом?

Сввязь с интернет всё есть php.ini настроен на прием и обработку url

config_weather.php

<?php

$idcity2 = "4944";
$namecity = "Киев";
$namecitys = "Погода в Киеве";

?>
 
Скажите этот скрипт только грабит погоду или можно создать аналог гизметео
 
Статус
В этой теме нельзя размещать новые ответы.
Назад
Сверху