Solved

write a text file

Posted on 2010-09-20
21
587 Views
Last Modified: 2012-05-10
using windows server 2008 dedicated server
php 5.2.6


D:\inetpub\vhosts\website1.com\httpdocs
D:\inetpub\vhosts\website2.com\httpdocs


want to write to a file.txt from website1.com to website2.com
0
Comment
Question by:rgb192
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
21 Comments
 
LVL 2

Expert Comment

by:skwok
ID: 33721198
Using PHP, have tried writing the file following the directions from the PHP website here:

http://php.about.com/od/advancedphp/ss/file_write_php.htm

and putting the full path in the file name?

 <?php $File = "/inetpub/hosts/website2.com/httpdocs/YourFile.txt"; $Handle = fopen($File, 'w'); $Data = "John Henry\n"; fwrite($Handle, $Data); $Data = "Abigail Yearwood\n"; fwrite($Handle, $Data); print "Data Written"; fclose($Handle); ?>
0
 

Author Comment

by:rgb192
ID: 33721752
that does not work
i can only write to website1.com
whether i use
filename c:/...
or
web address http://...
0
 

Author Comment

by:rgb192
ID: 33764500
thank you
0
Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 33801360
You won't be allowed to write to another website's directories.  Doesn't matter if it's all your server, it's a security violation to let one website write to the files of another.
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 33805275
unless they have a process that will allow it - like a form with a multiform file upload.
0
 

Author Comment

by:rgb192
ID: 33817619
inetpub/vhosts/website1.com
inetpub/vhosts/website2.com


can I write to
inetpub/vhosts/
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 33817840
Yes, if you have a server process that will write there and you have set the directory to writeable. However that is the surest way to get a worm/trojan installed
0
 

Author Comment

by:rgb192
ID: 33818504
>>Yes, if you have a server process that will write there and you have set the directory to writeable. However that is the surest way to get a worm/trojan installed


can there be a trojan installed if only I have access to the dedicated windows server 2008
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 33820292
Can you perhaps tell us exactly what you need to have happen?

For example HTA can write anywhere and does not need web servers.

If you need a form that is filled in on server 1 to store the result/a file on server 2 you WILL need to look at the upload processes I have suggested.
If you give them write access to the directory, they can write and save there
0
 

Author Comment

by:rgb192
ID: 33836131
i want to write to a text file for error logging

from website1.com and website2.com

no forms
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 33838626
On the same physical file system?

If not, then create a process on website2 that given a url will write the querystring to the server in a text file
0
 

Author Comment

by:rgb192
ID: 33890651
on the same file system
/inetpub/vhosts/website1.com/httpdocs


/inetpub/vhosts/website2.com/httpdocs
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 33891531
Here you should be able to find everything you need

http://msdn.microsoft.com/en-us/library/d6dw7aeh%28VS.85%29.aspx
0
 

Author Comment

by:rgb192
ID: 34012003
I dont understand the link.  Is there an easier way to do this.
0
 

Author Comment

by:rgb192
ID: 34012150
The link provides information on how to change all my server settings.  Isnt there an easier method.  Maybe just allowing write access.
0
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 500 total points
ID: 34012947
The link tells you how to use the file system object which is what you asked for.
You need that to write the file to the file system - AND you need to make the folder you write to accessible for the task that writes the file....
0
 

Author Closing Comment

by:rgb192
ID: 34121934
sorry this took so long, very complex task for me

I had to do the second part of the link


I got it working on another computer, so the link describes what do to
0

Featured Post

Office 365 Advanced Training for Admins

Special Offer:  Buy 1 course, get 2nd free!  Buy the 'Managing Office 365 Identities & Requirements' course w/ Accelerated TestPrep, and automatically receive the 'Enabling Office 365 Services' course FREE!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Lease-to-own eliminates the expenditure of hardware replacement and allows you to pay off the server over time. Usually, this is much cheaper than leasing servers. Think of lease-to-own as credit without interest.
This tutorial will walk an individual through the steps necessary to configure their installation of BackupExec 2012 to use network shared disk space. Verify that the path to the shared storage is valid and that data can be written to that location:…
To efficiently enable the rotation of USB drives for backups, storage pools need to be created. This way no matter which USB drive is installed, the backups will successfully write without any administrative intervention. Multiple USB devices need t…

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question