Forum Home
Press F1
 
Thread ID: 138616 2014-12-26 06:06:00 Redirecting an url using a variable rather than hard code iansmcdonald (6977) Press F1
Post ID Timestamp Content User
1390910 2014-12-26 06:06:00 Scenario:
Currently "fictitious.nz" is pointed to a file called "fictitious.php" residing on a server which redirects to 1.2.3.4 in the line that reads
"<meta HTTP-EQUIV="REFRESH" content="0; url=http://1.2.3.4">

What I want to do is put the "1.2.3.4" into a txt file 'externalip.txt' and have "fictitious.php" read that file and redirect accordingly.

I can get "fictitious.php" to read the file and display "1.2.3.4" on the screen, but I can't get it to redirect to "1.2.3.4".
I suspect it's along the lines of

<?php
$externalip = file_get_contents('externalip.txt');
echo $externalip;
?>
<meta HTTP-EQUIV="REFRESH" content="0; url=http://externalip.txt"

which doesn't work but I'm sure is fairly close.
Can anyone help me out?
I have a dangerously small knowledge of php...
iansmcdonald (6977)
1