ウェブサイトからxmlファイルを取得してファイルに保存する簡単なスクリプトを実行しようとしています。以下は関数です
/* update exchange rates */
public function getLatestExchangeRates(){
$xml = file_get_contents("http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml");
file_put_contents("xml/exchange_rates.xml", $xml);
}
echo "Update Exchange Rates <br>\n";
$scraper->getLatestExchangeRates();
このスクリプトをchromeで実行すると機能しますが、次のステートメントを使用してcmdプロンプトで実行すると
C:\xampp\php\php.exe -f C:\xampp\htdocs\sites\bk\update_exchange_rates.php
コンソールに次のエラーが表示されます。
warning: file_put_contents(xml/exchange_rates.xml: failed to open stream: no such file or directory in C:....
この問題を解決するにはどうすればよいですか?