dtby67541 2010-11-23 16:26
浏览 608

如何模拟使用PHP Curl启用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.

Can I enable JavaScript with PHP Curl?

  • 写回答

3条回答 默认 最新

  • dongshushen4392 2010-11-23 16:32
    关注

    No.

    This is simple like this - a page tests, if you have JavaScript enabled, by using the JavaScript to execute a command, that will remove things like "you don't have JavaScript enabled".

    Therefore, if you do NOT have JS enabled, the error won't go away.

    Optionally (and even more likely) the JavaScript will REDIRECT your browser to the actual page, if JS is not enabled - again, you will stay at the first page, which says you don't have JS enabled...

    PHP curl is NOT a full browser. It is just a library that is used for communicating with servers, using HTTP, FTP, et cetera. It does not do neither rendering nor parsing.

    For this functionality, you would need a JavaScript engine... to my knowledge there is not one in PHP that is fully functional.

    评论

报告相同问题?

悬赏问题

  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 关于#python#的问题:自动化测试