简体   繁体   English

获取PHP重定向URL

[英]get PHP redirect url

I am working on a application that requires me to get the final URL after redirection. 我正在开发一个需要重定向后获取最终URL的应用程序。 I tried different solutions before posting this question but nothing works. 在发布此问题之前,我尝试了其他解决方案,但没有任何效果。

The initial url to query is Base URL . 要查询的初始URL是Base URL It uses JS redirection and redirects to Redirect URL 它使用JS重定向并重定向到重定向URL

is there a way where I can get the final redirected url from the initial url ? 有没有一种方法可以从初始URL获得最终重定向的URL?

Use curl_getinfo() with opt parameter CURLINFO_EFFECTIVE_URL curl_getinfo()与opt参数CURLINFO_EFFECTIVE_URL

From above linked page: 从上面的链接页面:

CURLINFO_EFFECTIVE_URL - Last effective URL 

It is a JS redirect. 这是一个JS重定向。 If you look at the JS code of the first page you'll see how it generate the next URL. 如果查看第一页的JS代码,您将看到它如何生成下一个URL。 You can try to implement the same URL generation and get the final URL. 您可以尝试实现相同的URL生成并获取最终URL。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM