使用PHP抓取谷歌自定义搜索结果

时间:2014-09-14 11:55:53

标签: php simple-html-dom

我正在使用simple_html_dom.php

<?php
    include('simple_html_dom.php');

    $songName = '再见青春';

$dom = file_get_html('http://www.google.com/cse?q='. $songName .'&cx=partner-pub-4291153493758949%3A9692445719&cof=FORID%3A10&ie=UTF-8&ad=w9&num=1');

$firstRow = $dom->find('#gs-visibleUrl-long')->plaintext;

echo $dom;
var_dump($firstRow);

?>

$ dom还可以,但我想潜入DOM,它不起作用。 $firstRow返回NULL。我这样做报错了吗?

Dom和错误在这里http://daysof.me/chrome_lyric/lyric.php

0 个答案:

没有答案