Jump to content

write text file with url


cfgcjm

Recommended Posts

I'm building a site which includes a "tip of the day" which is read from a text file. I'm making an interface which the admin can change the text through. My problem is i'm not going to have my interface files in the same directory as my textfile. Therefore i have the problem shown below because fopen() can't handle URLs. How do i specify a url to do this. Also...if the user inputs and apostrophe it is transformed to a "\" in the text file. Is there a way to fix that?

 

<?php
$data = $_POST['tip'];
// Open the file and erase the contents if any
$fp = fopen("www.digiconmediagroup.com/Homplate/tip.txt", "w");
// Write the data to the file
fwrite($fp, $data);
// Close the file
fclose($fp);
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.