[英]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.