FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » PHP Function to translate a URL into the URL that it is redirected to
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
PHP Function to translate a URL into the URL that it is redirected to [message #174669] Sun, 26 June 2011 15:50 Go to next message
Charlie is currently offline  Charlie
Messages: 17
Registered: December 2010
Karma: 0
Junior Member
I need a function FUNCTION(URL1) = URL2 to which URL1 is redirected.

And the answer is . . . ?

Thanks,

Charlie
Re: PHP Function to translate a URL into the URL that it is redirected to [message #174670 is a reply to message #174669] Sun, 26 June 2011 17:19 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
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(at)attglobal(dot)net
==================
Re: PHP Function to translate a URL into the URL that it is redirected to [message #174671 is a reply to message #174669] Sun, 26 June 2011 19:08 Go to previous messageGo to next message
Adrienne Boswell is currently offline  Adrienne Boswell
Messages: 25
Registered: October 2010
Karma: 0
Junior Member
Gazing into my crystal ball I observed Charlie <shymathguy(at)gmail(dot)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
Re: PHP Function to translate a URL into the URL that it is redirected to [message #174672 is a reply to message #174671] Mon, 27 June 2011 03:08 Go to previous message
Michael Vilain is currently offline  Michael Vilain
Messages: 88
Registered: September 2010
Karma: 0
Member
In article <Xns9F107B75698B5arbpenyahoocom(at)88(dot)198(dot)244(dot)100>,
Adrienne Boswell <arbpen(at)yahoo(dot)com> wrote:

> Gazing into my crystal ball I observed Charlie <shymathguy(at)gmail(dot)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]
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Preserving an object
Next Topic: Stats comp.lang.php (last 7 days)
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Nov 22 21:16:17 GMT 2024

Total time taken to generate the page: 0.02976 seconds