FW: [SPAM] RE: [PHP] FW: [SPAM] RE: [PHP] fwrite() Append Files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>> -----Original Message-----
>> From: Chris Scott [mailto:Chris.Scott@xxxxxxxxxx]
>> Sent: Friday, June 27, 2008 8:48 AM
>> To: php-general@xxxxxxxxxxxxx
>> Subject:  FW: [SPAM] RE: [PHP] fwrite() Append Files
>> Importance: Low
>> 
>> I don't think you can open files for writing over http, you get an
>> error:
>> 
>> failed to open stream: HTTP wrapper does not support writeable
>> connections.
>> 
>> -----Original Message-----
>> From: Per Jessen [mailto:per@xxxxxxxxxxxx]
>> Sent: Friday, June 27, 2008 2:39 PM
>> To: php-general@xxxxxxxxxxxxx
>> Subject: [SPAM] RE:  fwrite() Append Files
>> Importance: Low
>> 
>> Wei, Alice J. wrote:
>> 
>> >
>> > Do you mean to edit $ourFileHandle to fopen($ourFileName, 'wba')?
>> >
>> 
>> I think fopen($ourFileName, 'a') will do what you want.
>
>From Alice's code:
>
>  $ourFileName = "hello.txt";
>
>   $ourFileHandle = fopen($ourFileName, 'wb') or die("can't open file");
>
>So... she is not, in fact, trying to write a file over HTTP. She is reading a file via HTTP and writing something pertaining to it >on the local file system.
>
>Also, please refrain from top-posting. It makes the posts get very confusing. :(
>
>
>Todd Boyd
>Web Programmer
>

Sorry about the top posting, just habit. I'll stop doing it.

>From Alice's code:

   $newFileName="http://www.yoursite.com/hello.txt";;
   echo $newFileName;
   $result=rename($ourFileName, $newFileName);
   $ourFileHandle = fopen($ourFileName, 'wb') or die("can't open file");

// Loop through our array, show HTML source as HTML source; and line numbers too.

  foreach ($lines as $line_num => $line) {

      echo "<p>Line #<b>{$line_num}</b> : " . htmlspecialchars($line) . "</p>";
      $ourFileHandle = fopen($newFileName, 'wb') or die("can't open file");
      $content=fwrite($ourFileHandle, htmlspecialchars($line));
......


The fwrite is $ourFileHandle which on the previous line is set to $newFileName which is http://www.yoursite.com/hello.txt.

I might have missed the point (I regularly do) but it looks like http to me.



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux