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

To print the URL redirection

SpaceshipSpaceship
Namecheap AuctionsNamecheap Auctions
Namecheap AuctionsNamecheap Auctions
Watch

newsiness

VIP Member
Impact
49
I search out the web but could get the solution, hopefully the expert here could me out. :P

Let's say a url
http://a.com is redirected to http://b.com

we input the url http://a.com
how can we use php script to print out the url http://b.com?

Thanks!
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
What do you mean print it out? I want to grab all contents of b.com put display it on a.com? Is there a particular reason why you want to that instead of a redirect?
 
0
Close
i think you got me wrong....

a php script to detect whether the url is redirected to another url or not.
 
0
Close
The easiest way is to use PHP5's get_headers() function and see if it returns a value for Location.

Example:

PHP:
$headers=get_headers($url,true);
if($headers['Location'])
	echo "Redirects to {$headers['Location']}";
else
	echo "No redirect";
 
0
Close
DomainEasy: flexible LTO options. Close more domain deals with financing.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

A browser tab with a favicon next to the page title
Search members
You can now search for members by name, company, location and more. Open the search at the top of any page and choose Members. You will...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back