Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #2345 > unrolled thread

PHP Function to translate a URL into the URL that it is redirected to

Started byCharlie <shymathguy@gmail.com>
First post2011-06-26 08:50 -0700
Last post2011-06-26 20:08 -0700
Articles 4 — 4 participants

Back to article view | Back to comp.lang.php


Contents

  PHP Function to translate a URL into the URL that it is redirected to Charlie <shymathguy@gmail.com> - 2011-06-26 08:50 -0700
    Re: PHP Function to translate a URL into the URL that it is redirected to Jerry Stuckle <jstucklex@attglobal.net> - 2011-06-26 13:19 -0400
    Re: PHP Function to translate a URL into the URL that it is redirected to Adrienne Boswell <arbpen@yahoo.com> - 2011-06-26 19:08 +0000
      Re: PHP Function to translate a URL into the URL that it is redirected to Michael Vilain <vilain@NOspamcop.net> - 2011-06-26 20:08 -0700

#2345 — PHP Function to translate a URL into the URL that it is redirected to

FromCharlie <shymathguy@gmail.com>
Date2011-06-26 08:50 -0700
SubjectPHP Function to translate a URL into the URL that it is redirected to
Message-ID<cd2488ac-2e6b-46e8-bfdc-18349a2db9c0@v31g2000vbs.googlegroups.com>
I need a function FUNCTION(URL1) = URL2 to which URL1 is redirected.

And the answer is . . . ?

Thanks,

Charlie

[toc] | [next] | [standalone]


#2346

FromJerry Stuckle <jstucklex@attglobal.net>
Date2011-06-26 13:19 -0400
Message-ID<iu7pm8$j11$1@dont-email.me>
In reply to#2345
On 6/26/2011 11:50 AM, Charlie wrote:
> I need a function FUNCTION(URL1) = URL2 to which URL1 is redirected.
>
> And the answer is . . . ?
>
> Thanks,
>
> Charlie

What are you trying to do?  PHP doesn't know anything about redirections 
other than being able to use the header() call to generate a redirection.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[toc] | [prev] | [next] | [standalone]


#2347

FromAdrienne Boswell <arbpen@yahoo.com>
Date2011-06-26 19:08 +0000
Message-ID<Xns9F107B75698B5arbpenyahoocom@88.198.244.100>
In reply to#2345
Gazing into my crystal ball I observed Charlie <shymathguy@gmail.com> 
writing in news:cd2488ac-2e6b-46e8-bfdc-18349a2db9c0
@v31g2000vbs.googlegroups.com:

> I need a function FUNCTION(URL1) = URL2 to which URL1 is redirected.
> 
> And the answer is . . . ?
> 
> Thanks,
> 
> Charlie
> 

Is this a quiz? Is this a moved permanently or moved temporarily?

It depends on why you want to do this, .htaccess would probably be the 
preferred method to do this, not PHP.

-- 
Adrienne Boswell at Home
Arbpen Web Site Design Services
http://www.cavalcade-of-coding.info
Please respond to the group so others can share

[toc] | [prev] | [next] | [standalone]


#2348

FromMichael Vilain <vilain@NOspamcop.net>
Date2011-06-26 20:08 -0700
Message-ID<vilain-8E8555.20084426062011@news.individual.net>
In reply to#2347
In article <Xns9F107B75698B5arbpenyahoocom@88.198.244.100>,
 Adrienne Boswell <arbpen@yahoo.com> wrote:

> Gazing into my crystal ball I observed Charlie <shymathguy@gmail.com> 
> writing in news:cd2488ac-2e6b-46e8-bfdc-18349a2db9c0
> @v31g2000vbs.googlegroups.com:
> 
> > I need a function FUNCTION(URL1) = URL2 to which URL1 is redirected.
> > 
> > And the answer is . . . ?
> > 
> > Thanks,
> > 
> > Charlie
> > 
> 
> Is this a quiz? Is this a moved permanently or moved temporarily?
> 
> It depends on why you want to do this, .htaccess would probably be the 
> preferred method to do this, not PHP.

Actually, the only way I know how to do this is to send a HTTP HEAD 
request.  It will come back with 301 or 302 and the new location. I 
think the OP wants the function to return the redirected URL which would 
be useful for updating bookmarks.  Or to flag a stale link to be updated 
manually.

I didn't think there is such a thing in PHP, but it turns out you can if 
you use the curl stuff.  Didn't try actually getting anything to work, 
but you could futz with

http://us.php.net/manual/en/function.curl-exec.php

and perhaps get the headers of a HEAD request through CURL.  That might 
get you the info you want.

-- 
DeeDee, don't press that button!  DeeDee!  NO!  Dee...
[I filter all Goggle Groups posts, so any reply may be automatically ignored]

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.php


csiph-web