How to redirect to a random link using php

Post Reply
User avatar
Neo
Site Admin
Site Admin
Posts: 2642
Joined: Wed Jul 15, 2009 2:07 am
Location: Colombo

How to redirect to a random link using php

Post by Neo » Mon Feb 22, 2010 9:51 pm

Code: Select all

<?php
// your links array
$links = array(
  'https://robot.lk.com',
  'http://coderlink.com',
  'http://buytiptop.com',
);

// select random link and redirect
header('Location: ' . $links[rand(0,count($links)-1)]);
?>
Post Reply

Return to “PHP & MySQL”