Php 文件获取内容(';http://example.com';)无法处理重定向链接?

Php 文件获取内容(';http://example.com';)无法处理重定向链接?,php,file,redirect,header,save,Php,File,Redirect,Header,Save,我的代码: $cc=file_get_contents('http://example.com'); file_put_contents('savefile.htm', $cc); 当我导航到此地址时,我的浏览器将重定向到“”。 但是文件内容不直接,我能做什么?似乎是PHP中已知的错误。见: $file = 'people.txt'; // Open the file to get existing content $current = file_get_contents($file); //

我的代码:

$cc=file_get_contents('http://example.com');
file_put_contents('savefile.htm', $cc);
当我导航到此地址时,我的浏览器将重定向到“”。
但是文件内容不直接,我能做什么?

似乎是PHP中已知的错误。见:

$file = 'people.txt';
// Open the file to get existing content
$current = file_get_contents($file);
// Append a new person to the file
$current .= "John Smith\n";
// Write the contents back to the file
file_put_contents($file, $current);
但是你可以用cURL来代替。有关示例,请参见。

的可能重复项