使用curl从一个网页转到另一个涉及javascript的网页 [英] using curl to get from one webpage to another involving javascript

查看:94
本文介绍了使用curl从一个网页转到另一个涉及javascript的网页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有webpage1.html,它具有一个超链接,其超链接href = some / javascript / function / outputLink()

I have webpage1.html which has a hyperlink whose href="some/javascript/function/outputLink()"

现在,使用curl(或任何其他方法)在php中)如何从javascript function()中推断出超链接(http://格式),以便可以转到下一页。

Now, using curl (or any other method in php) how do I deduce the hyperlink (of http:// format) from the javascript function() so that I can go to next page.

谢谢

推荐答案

您必须抓取JavaScript。找出函数的位置并查看其使用的URL。

You'd have to scrape the JavaScript. Figure out where the function is and see what URL it's using.

有时链接中省略了 http://

这时,唯一有价值的事情是尝试理解JavaScript代码自己,找到 link 后,就可以使用 regex 通过PHP以编程方式过滤结果。

At this point the only valuable thing to do is to try and understand the JavaScript code yourself, and once you find the link you could use regex to filter the result programmatically with PHP.

preg_match("/url + \'\/apples.html/g", "blah blah var javaScriptVar= url + '/apples.html';", $matches);

这篇关于使用curl从一个网页转到另一个涉及javascript的网页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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