This code below is using the FWRITE function. however i wish to save the file to a specific location but always get 'cant open file' as expected. i have setup the directory listed in mypath but it still wont write to that location.
$mypath = "http://www.mysite.com/test/data/";
$myFile = $mypath."data.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = "Some text";
fwrite($fh, $stringData);
fclose($fh);