Subversion Repositories Transart

Rev

Rev 2 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2 Rev 8
Line 124... Line 124...
124
              </label></td>
124
              </label></td>
125
            </tr>
125
            </tr>
126
  </table>
126
  </table>
127
                </form>        </td>
127
                </form>        </td>
128
      </tr>
128
      </tr>
129
      <tr>
-
 
130
      <td>
-
 
131
          <?php
-
 
132
          $apiKey = "0ad385eea94cf2a775c48da2dfc726e9";
-
 
133
          $cityId = "2761369";
-
 
134
          $googleApiUrl = "http://api.openweathermap.org/data/2.5/weather?id=" . $cityId . "&lang=de&units=metric&APPID=" . $apiKey;
-
 
135
 
-
 
136
          $ch = curl_init();
-
 
137
 
-
 
138
          curl_setopt($ch, CURLOPT_HEADER, 0);
-
 
139
          curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
-
 
140
          curl_setopt($ch, CURLOPT_URL, $googleApiUrl);
-
 
141
          curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
-
 
142
          curl_setopt($ch, CURLOPT_VERBOSE, 0);
-
 
143
          curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
-
 
144
          $response = curl_exec($ch);
-
 
145
 
-
 
146
          curl_close($ch);
-
 
147
          $data = json_decode($response);
-
 
148
          $currentTime = time();
-
 
149
          ?>
-
 
150
          <div class="report-container">
-
 
151
              <h2><?php echo $data->name; ?> Wetter</h2>
-
 
152
              <div class="time">
-
 
153
                  <div><?php echo date("l g:i a", $currentTime); ?></div>
-
 
154
                  <div><?php echo date("jS F, Y",$currentTime); ?></div>
-
 
155
                  <div><?php echo ucwords($data->weather[0]->description); ?></div>
-
 
156
              </div>
-
 
157
              <div class="weather-forecast">
-
 
158
                  <img
-
 
159
                          src="http://openweathermap.org/img/w/<?php echo $data->weather[0]->icon; ?>.png"
-
 
160
                          class="weather-icon" /> <?php echo $data->main->temp_max; ?>°C<span
-
 
161
                          class="min-temperature"><?php echo $data->main->temp_min; ?>°C</span>
-
 
162
              </div>
-
 
163
              <div class="time">
-
 
164
                  <div>Humidity: <?php echo $data->main->humidity; ?> %</div>
-
 
165
                  <div>Wind: <?php echo $data->wind->speed; ?> km/h</div>
-
 
166
              </div>
-
 
167
          </div>
-
 
168
 
-
 
169
      </td>
-
 
170
      </tr>
-
 
171
            <tr>
-
 
172
        <td class="stil3">
-
 
173
            <table class="ui celled green striped table">
-
 
174
        <?php
-
 
175
// Die Datei test.xml enthält ein XML-Dokument mit einem Wurzel-Element
-
 
176
// und mindestens einem Element /[root]/title.
-
 
177
 
-
 
178
if ($xml = simplexml_load_file('http://rss.orf.at/news.xml')) {
-
 
179
 
-
 
180
    //print_r($xml);
-
 
181
	
-
 
182
	   foreach ($xml->item as $item) {
-
 
183
		 echo "<tr>";  
-
 
184
  		 echo "<td>".$item->title."</td>"; echo "<td><a href='".$item->link."' target='_blank'>LINK</a></td>"; echo '</tr>';
-
 
185
	}
-
 
186
}
-
 
187
?>
-
 
188
        </table>
-
 
189
        </td>
-
 
190
 
-
 
191
      </tr>
-
 
192
    </table>    </td>
129
    </table>    </td>
193
  </tr>
130
  </tr>
194
</table>
131
</table>
Line 195... Line 132...
195
 
132