I need to write to a folder from outside the web root
this should not be a problem as long as you have a document root variable that points to the web root directory. for example, i always use
$document_root = $_SERVER['DOCUMENT_ROOT'];
once you have that, you can navigate your server to other directories using relative paths. so, if you had a directory named 'products' that was not in the web root and you wanted to write to a file in it named 'products_list.txt', you could do it with the following;
$fp = fopen("$document_root/../products/products_list.txt", 'ab');
where 'ab' means to append the file with binary mode. the ".." points to the parent directory of the web root directory. this is where the products directory will be.
need to put the address in a php file outside the web root on another server
this is obviously more complicated. once you set up your fopen() and other variables, you can include an ftp or http site as a fourth parameter in the (). so, using the example above, you can connect to a server at www.football.com with:
$fp = fopen("$document_root/../products/products_list.txt", 'ab', ,http:www.football.com/);
don't forget the trailing slash. in order to connect to other servers with php, the allow_url_fopen directive must be ON in the php.ini file. i believe you can also connect two servers with ssl using https:// for the fourth parameter.