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

如何模拟使用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 linux驱动,linux应用,多线程
  • ¥20 我要一个分身加定位两个功能的安卓app
  • ¥15 基于FOC驱动器,如何实现卡丁车下坡无阻力的遛坡的效果
  • ¥15 IAR程序莫名变量多重定义
  • ¥15 (标签-UDP|关键词-client)
  • ¥15 关于库卡officelite无法与虚拟机通讯的问题
  • ¥15 目标检测项目无法读取视频
  • ¥15 GEO datasets中基因芯片数据仅仅提供了normalized signal如何进行差异分析
  • ¥100 求采集电商背景音乐的方法
  • ¥15 数学建模竞赛求指导帮助