简体   繁体   English

如何使用PHP curl获得客户端最终重定向页面?

[英]How do I get the client side final redirected page using PHP curl?

I am trying to scrape a website ' http://www.motorsingh.com/red-olx-cars-in-gulabpura '. 我正在尝试抓取一个网站' http://www.motorsingh.com/red-olx-cars-in-gulabpura '。 But this does a javascript redirect to 404 after the page is loaded with a 200 success code. 但这确实会在页面加载200成功代码后将javascript重定向到404。

How can I get this final redirected url using PHP Curl? 如何使用PHP Curl获得此最终重定向的URL?

PS: Have tried CURLOPT_FOLLOWLOCATION. PS:尝试过CURLOPT_FOLLOWLOCATION。 Dint work. 努力工作。

You can't get a JS redirect purely in curl - you will need a JS interpreter to go further. 您不能纯粹在curl中获得JS重定向-您将需要JS解释器才能进一步。

There are some horrendous half-working hacks, like regexing out a URL from the page contents, but it's a bad idea and difficult to maintain. 有一些可怕的半工半巧的方法,例如从页面内容中重新指定URL,但这是一个坏主意且难以维护。

暂无
暂无

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

相关问题 我如何使用Href但不能重定向? 使用HTML - How do i use Href but not get redirected? using HTML 如何在客户端使用 Javascript 检测页面是否是重定向 - How do you detect if the page is a redirect using Javascript in the client side 我如何使用php从客户端获取套接字的标头请求 - how can i get the headers request from client side for sockets using php Firebase:如果我使用服务器端 session cookies,如何在客户端获取登录用户的 ID 令牌? - Firebase: How do I get the ID Token for a signed-in user on the client side if I am using server-side session cookies? 如何使用 PHP 实际检索服务器端信息,客户端 JavaScript 程序使用 fetch() function 发送给它? - How do I actually retrieve information server-side using PHP that a client-side JavaScript program sent to it with the fetch() function? 在客户端 JS 中使用 npm package 时,如何消除此错误? - How do I get rid of this error while using npm package in client side JS? 如何使用 Node/Express 从客户端调用 ajax get 请求? - How do I call a invoke an ajax get request from client side, using Node/Express? 如何使用Javascript获取文件夹客户端中的文件列表? - How do I get a list of files in a folder client-side using Javascript? 为什么我在访问安全页面时没有被重定向到 /login? - Why do I not get redirected to /login when accessing a secure page? 如何将javascript值发送到php并使其显示在重定向页面中 - How to send a javascript value to php and get it displayed in redirected page
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM