My code:
$cc=file_get_contents('http://example.com');
file_put_contents('savefile.htm', $cc);
When I navigate to this address, my browser redirects to 'http://example.com/en/index.htm'. But file_get_contents doesn't recdirect, what can I do?
My code:
$cc=file_get_contents('http://example.com');
file_put_contents('savefile.htm', $cc);
When I navigate to this address, my browser redirects to 'http://example.com/en/index.htm'. But file_get_contents doesn't recdirect, what can I do?
$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);
Seems to be a known bug in PHP. See: https://bugs.php.net/bug.php?id=53018
But you can use cURL instead. See http://www.jonasjohn.de/snippets/php/curl-example.htm for some example.