-4

テーブルデータ<table bgcolor="#004e8e" width="100%" align="center" cellpadding="3" cellspacing="0" id="borda_bai">サイトhttp://www.orientcinemas.com.br/programacao/cinema.php?cod=5をphpで抽出する方法は?

そしてもう1つの質問は、各データテーブルをxmlに配置する方法です。

例:同じサイトのテーブル

C1 C2 C3 C4 C5
L1
L2
L4
L5

そしてxmlでC1L1=>

<C1>
                 <L1> </ L1>
                 <L2> </ L2>                
</ C1>
データの処理/使用を容易にします:(

4

3 に答える 3

1

XPathSelectorを使用できます。

$xs = XPathSelector\Document::loadHTMLFile('http://www.orientcinemas.com.br/programacao/cinema.php?cod=5');
$table = $xs->select('//*[@id="borda_bai"][1]');
$result = array();
$row = 0;
foreach ($table->select('tr[position()>1]') as $tr) {
    $row++;
    $column = 0;
    foreach ($tr->select('td') as $td) {
        $column++;
        $result[$row][$column] = $td->extract();
    }
}

$result は次のようになります。

Array
(
    [1] => Array
        (
            [1] => 1
            [2] => 243
            [3] => A Saga Crep├║sculo: Amanhecer - Parte 2
            [4] => 12a.
            [5] => Dub. - 13h30, 16h00, 18h30, 21h00
        )
    etc......
)
于 2012-11-27T18:42:13.157 に答える
0

カールはそれをしません。Curl はリクエストを行うために使用されます。記述したhtmlの解析は、DOM、XPath、およびSimpleXMLで実行できます。

于 2012-11-27T17:14:52.957 に答える
0

You could use Matthias Kerstner's HTML Table Extractor.

http://www.kerstner.at/en/2011/02/html-table-extractor/

于 2012-11-27T15:11:51.547 に答える