开发者

fetching google images through html dom parser

I want to fetch images from goolge/images again any query. I am using following code but h开发者_如何学Caving no result. count always return zero.

$html = new simple_html_dom();
        $html=file_get_html('http://www.google.com.pk/images?q='.$_GET['q']);
        $find=$html->find('ul.rg_ul li');
        echo(count($find));

First i want to get all li tags from ul.rg_ul. But it always return zero. what is wrong with it. i am totally stuck on this. I have even tried

$find=$html->find('a.rg_l img');
but result is always zero


At last found solution by self learning and researching after receiving no response. Google doesn't support the method which i was using. Google provides its API to fetch the images. But I have done it by a mini google bot. Now any one who is facing problem can get advantage from here :P

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜