Trying to do something that should be very easy but not for me. I am trying to pass a variable thru a $_GET to php and store it in a text file. The variable ip is posted from an external source. I have the following: The xxx represent the ip address
$myFile = "http://xxx.xxx.x.x/iploc.txt";
$var1 =$_GET['ip'];
$fh = fopen($myFile, 'w') or die("can't open file");
fwrite($fh, $var1);
fclose($fh);
I have tried to test this by entering http://xxx.xxx.x.x/iploc.php?ip=1234 into my web address bar to see what happens. It displays the iploc.php content and does not save the ip to the text file. I know little about doing this so be kind. By looking at my server access log it seems to be getting there. Thanks in advance