如何从重定向获取最终URL? [英] How do I get the final url from a redirection?

查看:76
本文介绍了如何从重定向获取最终URL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我想捕获网站重定向到的最终网址。


这是我的意思的一个例子:


www.example.com/sites.php?pd=45

当您点击该链接时,该网站将重定向您


www.Joe-Blogs.com/green/prod1.html?a=527


你可以看到它们是两个不同的网站。


我想做的是选择

www.Joe-Blogs.com/green/prod1.html最后网址的一部分

并将其放在一个名为$ final_url的变量中。


如果我有:


展开 | 选择 | Wrap | 行号

解决方案

final_url。


如果我有:


展开 | 选择 | 换行 | 行号


< blockquote>您是否尝试制作某种Web代理?如果是这样,有很多,如PHProxy http://www.phproxy.org/ (源代码: http://sourceforge.net/projects/poxy/)。

没有必要重新发明轮子。


祝你好运


谢谢,


但是我没有尝试建立代理,


我想得到最终的网址,以便我可以在另一个网站上使用它

根据网址进行分析的网站。


Hi,

I want to capture the final url that a website redirects to.

Here is an example of what I mean:

www.example.com/sites.php?pd=45

When you click on that link, the site will redirect you to

www.Joe-Blogs.com/green/prod1.html?a=527

As you can see they are two different sites.

What I would like to do is pick the
www.Joe-Blogs.com/green/prod1.html part of the final url
and put it in a variable called $final_url.

So if I have :


Expand|Select|Wrap|Line Numbers

解决方案

final_url.

So if I have :


Expand|Select|Wrap|Line Numbers


Are you trying to make some kind of web proxy? If so, there are quite a few around, like PHProxy http://www.phproxy.org/ (source code: http://sourceforge.net/projects/poxy/).
There''s no need to reinvent the wheel.

Best regards


Thanks,

but no I am not trying to build a proxy,

I want to get the final url so that I can use it in another
web site that does analysis based on the url.


这篇关于如何从重定向获取最终URL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆