Re: Why i can't write to remote file ?
| From: | Darren | Date: | Fri, 18 May 2001 21:07:34 +0000 |
| Subject: | Re: Why i can't write to remote file ? | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-7736@lists.php.net to get a copy of this message | ||
"m.aprea" <m.aprea@tiscalinet.it> wrote in message
news:3B058C16.4A6E8629@tiscalinet.it...
> Hi everyone,
>
> I write a html page with a form with two parameter;
> neckties (the unit-cost) and the number of neckties, the action
> associated to submit
> is a PHP file "calculate.php" that writes to a remote file
> "datafile.txt" as follows:
>
> :
> :
> Total cost of the neckties <?php $result = $neckties * $number;
> echo $result;
> $fp =
>
> fopen("http://localhost/examples/datafile.txt","w");
> if (!$fp) {
> echo "<p>Unable to open remote file for writing.\n";
> exit;}
> fputs($fp,$result);
> fclose($fp);
> echo "total";
> echo $result;
> ?>
> :
> :
>
> When I call my html page and i give dates (e.g. 30 and 3) and click
> submit, the file calculate.php
> runs but i have the message:
>
> Total cost of the neckties 90
> Warning:
> fopen("http://localhost/examples/datafile.txt","w")
> - No error
> in c:\webshare\wwwroot\examples\calculate.php on line 11
>
> Unable to open remote file for writing.
>
> The line 11 is that contains fopen.
>
> I have Win98, Apache 1.3.19, PHP4.
>
> Where is the problem, inside Apache or inside PHP4. I think inside
> Apache, but whewre into the httpd.conf file ??
> Thank you in advance
>
I am thinking thatyou don't have right access. Have you tried omitting the
http header"