如何获取由JavaScript使用cURL加载的web内容? [英] How to get webcontent that is loaded by JavaScript using cURL?

查看:683
本文介绍了如何获取由JavaScript使用cURL加载的web内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从网站上取得分数表。问题是网站使用的是显然在 document.ready 上加载的javascript。

I am trying to grab the score table from a website. The problem is that the site is using javascript that apparently loads on document.ready.

似乎成功获得表,我得到的是该页面顶部的按钮。

For that reason I don't seem to succeed getting the table and all I get is the buttons at the top of that page.

有关如何解决此问题的任何建议或想法?

Any suggestions or ideas on how to solve this?

推荐答案

cURL只会给你页面的标记。它不会加载任何其他资源或处理页面。您可能想要查看类似 PhantomJS 的内容。 PhantomJS是一个无头WebKit浏览器。它有自己的API,让你脚本的行为。所以你可以告诉PhantomJS加载页面并转出你需要的数据。

cURL will only get you the markup of the page. It won't load any additional resources or process the page. You probably want to look at something like PhantomJS for this. PhantomJS is a headless WebKit browser. It has its own API that lets you "script" behavior. So you can tell PhantomJS to load the page and dump out the data you need.

这篇关于如何获取由JavaScript使用cURL加载的web内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆