I"m trying to pass some code through a redirect and I'm getting an error.
Anyone have any suggestion?
This is the redirect with the code
<?
$urls = array(
"http://url1.com/?id=<?php echo str_replace('-', ' ', $_GET['id'])?>",
"http://url2.com/?id=<?php echo str_replace('-', ' ', $_GET['id'])?>");
$url = $urls[array_rand($urls)];
$destination = "Location: $url";
header($destination);
?>
Any help is much appreciated.
Thanks!
Quick Question
Moderator: General Moderators
Re: Quick Question
I think this will work.
Code: Select all
<?
$urls = array(
"http://url1.com/?id=".str_replace('-', ' ', $_GET['id']),
"http://url2.com/?id=".str_replace('-', ' ', $_GET['id'])
);
$url = $urls[array_rand($urls)];
$destination = "Location: $url";
header($destination);
?>Re: Quick Question
You are opeing PHP Tags from within another PHP Tag, Look up PHP String Concatenationcloggin55 wrote:I"m trying to pass some code through a redirect and I'm getting an error.
Anyone have any suggestion?
This is the redirect with the code
<?
$urls = array(
"http://url1.com/?id=<?php echo str_replace('-', ' ', $_GET['id'])?>",
"http://url2.com/?id=<?php echo str_replace('-', ' ', $_GET['id'])?>");
$url = $urls[array_rand($urls)];
$destination = "Location: $url";
header($destination);
?>
Any help is much appreciated.
Thanks!