http://stackoverflow.com/quest...ifying-data-language-utf-8-and
Tu sam ja nesto sastavio ...
Na test local serveru mi radi redovno, otvara stranica i vidi se vremenska.
Kada ga stavim na remote server ne otvara stranicu. Dobijam gresku:
Code:
Warning: file_get_contents(http://www.google.com/ig/api?weather=palić&hl=hr) [function.file-get-contents]: failed to open stream: Permission denied in /home/www/palic.moleri.org/index.php on line 4
Fatal error: Call to a member function xpath() on a non-object in /home/www/palic.moleri.org/index.php on line 7
Warning: file_get_contents(http://www.google.com/ig/api?weather=palić&hl=hr) [function.file-get-contents]: failed to open stream: Permission denied in /home/www/palic.moleri.org/index.php on line 4
Fatal error: Call to a member function xpath() on a non-object in /home/www/palic.moleri.org/index.php on line 7
Index.html sam preimenovao u index.php i tu linije izgledaju ovako:
Code:
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2 <?
3 $URL = "http://www.google.com/ig/api?weather=palić&hl=hr";
4 $dataInISO = file_get_contents($URL);
5 $dataInUTF = mb_convert_encoding($dataInISO, "UTF-8", "ISO-8859-2");
6 $xml = simplexml_load_string($dataInUTF);
7 $information = $xml->xpath("/xml_api_reply/weather/forecast_information");
8 $current = $xml->xpath("/xml_api_reply/weather/current_conditions");
9 $forecast_list = $xml->xpath("/xml_api_reply/weather/forecast_conditions");
10 ?>
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2 <?
3 $URL = "http://www.google.com/ig/api?weather=palić&hl=hr";
4 $dataInISO = file_get_contents($URL);
5 $dataInUTF = mb_convert_encoding($dataInISO, "UTF-8", "ISO-8859-2");
6 $xml = simplexml_load_string($dataInUTF);
7 $information = $xml->xpath("/xml_api_reply/weather/forecast_information");
8 $current = $xml->xpath("/xml_api_reply/weather/current_conditions");
9 $forecast_list = $xml->xpath("/xml_api_reply/weather/forecast_conditions");
10 ?>
Vremenska izgleda ovako:
Code:
<!-- vremenska -->
<div id="vremenska">
<div id="module">
<h3>Danas</h3>
<div class="weather">
<table border="0">
<tr>
<td><img src="<?= 'http://www.google.com' . $current[0]->icon['data']?>" alt="Palić Vremenska Prognoza" class="vremenska_icone"?></td>
<td><div><?= $forecast->day_of_week['data']; ?></div>
<span class="condition">
<?= $current[0]->temp_c['data'] ?>° C,
<?= $current[0]->condition['data'] ?>
</span></td>
</tr>
</table>
</div>
<h3>Prognoza</h3>
<?php foreach ($forecast_list as $forecast) : ?>
<div class="weather">
<table border="0">
<tr>
<td><img src="<?= 'http://www.google.com' . $forecast->icon['data']?>" alt="Palić Vremenska Prognoza" class="vremenska_icone"?></td>
<td><div><?= $forecast->day_of_week['data']; ?></div>
<span class="condition">
<?= $forecast->low['data'] ?>° C - <?= $forecast->high['data'] ?>° C,
<?= $forecast->condition['data'] ?>
</span></td>
</tr>
</table>
</div>
<?php endforeach ?>
</div>
</div>
<p>
<!-- vremenska -->
<!-- vremenska -->
<div id="vremenska">
<div id="module">
<h3>Danas</h3>
<div class="weather">
<table border="0">
<tr>
<td><img src="<?= 'http://www.google.com' . $current[0]->icon['data']?>" alt="Palić Vremenska Prognoza" class="vremenska_icone"?></td>
<td><div><?= $forecast->day_of_week['data']; ?></div>
<span class="condition">
<?= $current[0]->temp_c['data'] ?>° C,
<?= $current[0]->condition['data'] ?>
</span></td>
</tr>
</table>
</div>
<h3>Prognoza</h3>
<?php foreach ($forecast_list as $forecast) : ?>
<div class="weather">
<table border="0">
<tr>
<td><img src="<?= 'http://www.google.com' . $forecast->icon['data']?>" alt="Palić Vremenska Prognoza" class="vremenska_icone"?></td>
<td><div><?= $forecast->day_of_week['data']; ?></div>
<span class="condition">
<?= $forecast->low['data'] ?>° C - <?= $forecast->high['data'] ?>° C,
<?= $forecast->condition['data'] ?>
</span></td>
</tr>
</table>
</div>
<?php endforeach ?>
</div>
</div>
<p>
<!-- vremenska -->
U cemu je problem gde sam pogresio zasto neradi na remote
Pozdrav