简单的html dom php脚本

时间:2013-06-13 16:08:11

标签: php javascript parsing web-scraping

我有从网站上抓取信息的任务。我有这个代码,刮掉了公司的名称。但其他细节在javascript中,当您单击标题时,将显示其他信息。

目前这是我的标题代码。

<?php

include 'simple_html_dom.php';

$url = 'http://www.streetdirectory.com/businessfinder/malaysia/kl/company/2828/Spa_and_Massage/';
$html = file_get_html($url);
echo "<table>";

foreach($html->find('div.company_profile') as $wrapper) {
    foreach($wrapper->find('table') as $table) {
        $tr = $table->find('tr', 0);
        foreach($tr->find('h3') as $company) {
            $name = $company->plaintext;
            echo '<tr><td>'.$name.'</td>';
        }
    }
}

echo '</table>';

我将更改为我的代码,以便我可以在javascript中删除信息?非常感谢。请不要忘记我是新手。

0 个答案:

没有答案