本文介绍了如何模拟使用PHP Curl启用JavaScript?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用PHP Curl从网页解析HTML代码,但是有一个错误信息,我无法访问没有JavaScript的网站。

I want to parse the HTML code from a webpage with PHP Curl, but there is an error msg that I can't access the site without JavaScript.

可以我用PHP Curl启用JavaScript?

Can I enable JavaScript with PHP Curl?

推荐答案

JavaScript由浏览器执行; cURL没有JavaScript解析器,因此无法执行它。

JavaScript is executed by a browser; cURL does not have a JavaScript parser, therefore can not execute it.

因为网站期望告诉它javascript已启用,所以你需要使用可以通过实际浏览器执行网页的工具,为您提供html。

Because the website is expecting something to tell it that javascript is enabled, you'll need to use a tool that can execute the webpage through an actual browser to give you the html.

这篇关于如何模拟使用PHP Curl启用JavaScript?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 08:07