agnostic Posted July 14, 2008 Share Posted July 14, 2008 I'm trying to make a PHP script that grabs any variables followed by the php script... i.e. http://www.mydomain.com/script.php?user105 and when someone visits that script it would grab "user105" and save to a text file on the host. Or something that grabs the requested url and saves it to a text file. Link to comment https://forums.phpfreaks.com/topic/114585-grabbing-requested-url-variable/ Share on other sites More sharing options...
Lodius2000 Posted July 14, 2008 Share Posted July 14, 2008 user105 would be a value of a variable, but you are missing the variable name say your url was blah.php?id=user105 now in your script you could use $id=$_GET['id']; $id now contains 'user105' EDIT: that is how the GET superglobal works, but i suggest you do some research on it too so that you truely know how to use it Link to comment https://forums.phpfreaks.com/topic/114585-grabbing-requested-url-variable/#findComment-589165 Share on other sites More sharing options...
agnostic Posted July 14, 2008 Author Share Posted July 14, 2008 I know about the value of variable and the variable name but I am trying to find a way of stripping the value of variable and save to text file as there will not be a variable name. Also a php function that would log the requested url would do. Link to comment https://forums.phpfreaks.com/topic/114585-grabbing-requested-url-variable/#findComment-589171 Share on other sites More sharing options...
Lodius2000 Posted July 14, 2008 Share Posted July 14, 2008 go with my earlier post http://us2.php.net/fopen http://us2.php.net/fwrite http://us2.php.net/fclose http://www.tizag.com/phpT/filewrite.php //that will tell you how to write to a text file using these 3 functions insert $id into the file Link to comment https://forums.phpfreaks.com/topic/114585-grabbing-requested-url-variable/#findComment-589237 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.