James Williams
asked on
PHp Fwrite Fopen Name file with URL
How can I get php to create a file then write to it using
the URL for the name.
http://example.com/hey/you/
and the output file name would be
heyyou.txt
I have been at this for a while now.
Thnk you in advance.
the URL for the name.
http://example.com/hey/you/
and the output file name would be
heyyou.txt
I have been at this for a while now.
Thnk you in advance.
$fp=fopen("comm.txt",'ab');
fwrite($fp,$outputstring);
fclose($fp);
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If you print out the contents of _GET with print_r, you should see a field that contains the full URL.
Off the top of my head, $_SERVER['QUERY_STRING'] might contain what you need. You can print it out to see. Sorry, I'm not near a web server at the moment to test it out right now.
Off the top of my head, $_SERVER['QUERY_STRING'] might contain what you need. You can print it out to see. Sorry, I'm not near a web server at the moment to test it out right now.
ASKER
Thank you. I'll get it now.
Regards.
Regards.
$uri = $_SERVER['REQUEST_URI'];
echo $uri;
ASKER
The problem I am having is Grabbing The actual URL of the page.
As the $url in not known for it is dynamic.
Something like
$url = $_GET["_$request"]; .
How do I dynamically set the $url
Thank you.
Selvol