Jump to content

Grabbing Requested URL Variable


agnostic

Recommended Posts

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

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

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

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.