Dynadot Aftermarket: discover domain gems worth investing in. Visit our aftermarket.

Need a random url script

Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
Spacemail by SpaceshipSpacemail by Spaceship
Watch

hound

Established Member
Impact
0
hope this isn't too off topic but does anyone know of a simple random url script? prefereably php or javascript
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Random URL script meaning?
 
0
Close
What specific "Random URL Script" is it? Got any sample sites? :)
 
0
Close
Would it be something like:
Submit URL
Select random from site

or

Generates random URL?
 
0
Close
0
Close
Submitted pages? or just goes to any page on the web?
 
0
Close
Submitted pages? or just goes to any page on the web?

i'll define the pages. i used to have a script that would go to a random page. had a text file where you could list the urls.
that was several computers ago and it's a goner now.
anyway, i'm looking for a script where i can list a bunch of urls and have it go to one of them. doesn't really have to be in php.
thanks
stevie
 
0
Close
Create theses 2 files:
file.php (or what ever you want to call it)
url.txt

Put this in the .php file:
PHP:
<?
$lines = file("url.txt") ; 
$url = $lines[array_rand($lines)] ; 
header("LOCATION: $url");
?>

then put the url's in the url.txt file (one URL per line)(make sure each URL has http:// or https://).
 
3
Close
Create theses 2 files:
file.php (or what ever you want to call it)
url.txt

Put this in the .php file:
PHP:
<?
$lines = file("url.txt") ; 
$url = $lines[array_rand($lines)] ; 
header("LOCATION: $url");
?>

then put the url's in the url.txt file (one URL per line)(make sure each URL has http:// or https://).


how many pages will randomize?
 
0
Close
You can add as many sites to url.txt you want.
It will only send you to 1 site though.
Unless you want it to send you to more.
 
1
Close
Its better to use a Database rather than a file because during concurrent read operations by different clients, your file may get struck or even corrupted.
Database is reliable for long term.
 
Last edited:
1
Close
I agree with robin.
 
0
Close
This is really cool I will give it a test
 
0
Close
thanks! i'll try it
 
0
Close
Your welcome.
Hope it works for you ;)
 
0
Close
Simple and works great.
 
0
Close
What should I make the url on the page to go to the random link?

---------- Post added at 08:39 AM ---------- Previous post was at 08:32 AM ----------

nvm figured it out
 
0
Close
1
Close
Janine, PERL is black magic! haha :)
 
0
Close
DomainEasy: white label portfolios are live. Enable yours.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back