Dynadot โ€” .com Registration $8.99

To print the URL redirection

Spaceship Spaceship
Watch
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
•••
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
•••
i think you got me wrong....

a php script to detect whether the url is redirected to another url or not.
 
0
•••
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
•••
Dynadot โ€” .com Registration $8.99Dynadot โ€” .com Registration $8.99
Unstoppable Domains
Domain Recover
DomainEasy โ€” Live Options
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back