我有个问题。
我如何从谷歌搜索回复中获得数据?即:关于博客的230,533,709的结果1-100.(0.25秒)
我想得到值230,533,709。
我使用php从url获取html响应。即:http://blogsearch.google.com/blogsearch?hl=en&ie=UTF-8&q=blogs&btnG=Search+Blogs
我使用ajax从php获取代码:
$.ajax({
url: "urlToPhp",
type: "GET",
dataType: "html",
data: $('#form').serialize(),
beforeSend: function(){},
success: function(html) {
->what to do with html to get the value 230,533,709???
$('#results').html(test).show('slow');
}
});
请帮帮忙。我不知道该怎么做。致以问候!
还是不起作用。请您粘贴完整的代码,如何获取内容,然后解析结果值?
我试过这段代码,但不起作用:
$("#results").load("http://blogsearch.google.com/blogsearch?hl=en&ie=UTF-8&q=blogs&btnG=Search+Blogs", function(data){
alert(data); <- returns empty string
alert($(data).text()); <-returns null
alert($(data).find('b:eq(3)')); <- returns "[object Object]"
});
为什么数据不是下载的内容。什么是对象对象?
谢谢你的帮助。
致以问候!
发布于 2009-10-31 02:31:48
是否尝试使用选择器(未测试,可能需要顶部调整选择器):
var count = $(html).find('table.ttt td.rsb b:nth-child(2)').html();
更新:
调整选择器:
var count = $(html).find('b:eq(3)').html();
发布于 2009-10-31 02:47:01
这个怎么样(基于达林的回答):
$('table.ttt td.rsb b:nth-child(3)').html();
我得到了261,022,603
发布于 2011-05-07 07:45:26
好主意是-
preg_match()
不要对来自google的页面使用jquery。
https://stackoverflow.com/questions/1653991
复制相似问题