こんにちは、Google 天気 API の天気アイコンを変更する最良の方法は何かをお聞きしたいのですが、パスを /ig/images/weather ではなく mysite.com/images/weather に変更します。ここでスタックオーバーフローで同じ問題を抱えているものを見ましたが、コードに実装する方法がわかりません。
ここに私のコードがあります:
<?php
$xml = simplexml_load_file('http://www.google.com/ig/api?weather=new-york');
$information = $xml->xpath("/xml_api_reply/weather/forecast_information");
$current = $xml->xpath("/xml_api_reply/weather/current_conditions");
$forecast_list = $xml->xpath("/xml_api_reply/weather/forecast_conditions");
?>
<h1>New-York City Weather</h1>
<div class="weather">
<img src="<?php echo 'http://www.google.com' . $current[0]->icon['data']?>" alt="weather" />
<div class="condition"><strong>Today</strong><br />
<?php echo $current[0]->temp_f['data'] ?>° F,<?php echo $current[0]->condition['data'] ?>
</div>
</div>
<?php foreach ($forecast_list as $forecast) { ?>
<div class="weather">
<img src="<?php echo 'http://www.google.com' . $forecast->icon['data']?>" alt="weather" />
<div class="condition">
<strong><?php echo $forecast->day_of_week['data']; ?></strong><br />
<?php echo $forecast->low['data'] ?>° F - <?php echo $forecast->high['data'] ?>° F,
<?php echo $forecast->condition['data'] ?>
</div>
</div>
<?php } ?>
手伝ってくれてどうもありがとう