从外部网页(php 或 java)获取值
我需要从外部网页获取一个号码
<span>
<b>Maximum price:</b>
7 //value i need
</span>
然后显示该号码
I need to get a number from a external webpage
<span>
<b>Maximum price:</b>
7 //value i need
</span>
Then display said number
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果你知道页面的地址,并且确定其内容在这段时间内不会改变,你可以通过 DOM 的方式找到数字。但我需要有关您的问题的更多详细信息。
If you know the address of the page and you are sure that their content will not change during the time, you can find the number by means of DOM. But I need more detail about your problem.
以下代码有效。我已使用此线程作为源页面。
The following code works. I've used this thread as the source page.
在 Java 中,您可以使用 HTMLUnit 库。它擅长 HTML 提取。
例如类似的东西:
In Java you can use HTMLUnit library. It's good at HTML extraction.
For example something similar to: