Your code isn't even close to what you want to do.
The following functions are intended to be used together. Read the man pages for each:
fopen
fread
fwrite
fclose
First you fopen() a file, then you can read or write to it (depending on the mode in which it was opened), then you should close it when you're done.
PHP supports opening remote HTTP URLS for reading, but not for writing.
When you use fopen(), it returns a file pointer. NOT a string containing the file.
To read the file, you have to call fread() with the proper arguments, INCLUDING the valid file pointer.
To use fwrite(), you have to fopen() the local file with the proper arguments, and then call fwrite(), passing the local file pointer as well as the data to be written.
You should ALWAYS check the value of the returned file pointer after calling fopen() to ensure that the call succeeded. If you try to open a nonexistent file for reading, or if you do now have write permissions to the directory you're trying to write into, fopen() will return a null value.
$maxfile = 500000; // some reasonable limit
$toss= "/home/htdocs/php/test.html";
$fp = fopen("http://www.website.co.uk/index.html", "r");
if (!$fp) die('Could not open remote file');
// now read up to $maxfile bytes
$remotedata = fread($fp, $maxfile);
fclose($fp😉
// now open the local file
$fp = fopen($toss,'w');
if (!$fp) die("Unable to open $toss");
// write the data
fwrite($fp,$remotedata));
fclose($fp);