我想將下面的鏈接輸出保存到file.xml,但它不適用於我。它只是在另一個瀏覽器上顯示輸出。將瀏覽器輸出保存到php中的xml文件
$url = 'http://www.forexwire.com/feed/full?username=alumfx&password=T7M9Exb4';
$fp = fopen (dirname(__FILE__). '/file.xml', 'w+');
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_TIMEOUT, 50);
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_exec($ch);
curl_close($ch);
$ch->save('file.xml');
fclose($fp);
'$ ch-> save'它是什麼? Curl_init返回句柄以使資源不是具有保存方法的對象。 – Robert