-4

I am able to take the values from a URL's query string and store them in some variables, however I would also like to print or write these values to a single line in a .txt document, and save that document in a given directory on the server.

Each time the page is loaded with a new query string, a new line will be added to that .txt file with the string values, and the file re-saved.

Can this be done? Struggling to find answers to this in my searches.

Many thanks in advance.

alexconnor7
  • 119
  • 1
  • 2
  • 9

1 Answers1

4

As simple as:

$url_value = "This is some value\n";
file_put_contents("/your/filename/here.txt", $url_value, FILE_APPEND );

See file_put_contents() for more information.

Jan
  • 42,290
  • 8
  • 54
  • 79