0

私はここにこのウェブサイトを持っています: http://www.wdjc.de/euro/index.php 自分で何もせずに解決策を探すだけではありませんが、これを変えるたびにエンドポイントに行き詰まります.

私の 2 つのアイデアから、通常は次のようなスクリプトを作成します。

<?
$ch = curl_init ("http://www.wdjc.de/euro/index.php");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$page = curl_exec($ch);

preg_match('#<table[^>]*>(.+?)</table>#is', $page, $matches);
foreach ($matches as &$match) {
    $match = $match;
}
echo '<table>';
    echo $matches[1];
echo '</table>';
?>

これはまったく機能しません。テーブルの頭だけが表示されます。だから私はこれを構築するという考えを得ました:

<?
$handle = fopen('http://www.wdjc.de/euro/index.php', 'r');
while (!feof($handle))
{
    $html .= fread($handle, 4096);
}
$begin = '  <table width="900" class="clean">';
$end = '</table>';

$beginloc = strpos($html, $begin) + strlen($begin);
$endloc = strpos($html, $end);

$html = substr($html, $beginloc, $endloc - $beginloc);
echo "<table width=100%>";
$html = str_replace("</tr>", "</tr>\n", $html);
$html = str_replace("</td>", "</td>\n", $html);
$html = str_replace("<td width", "<td nowrap ", $html);

echo $html;
echo "</table>";
?>

また、すべての列の後にあるエンドポイントのために機能しません。しかし、このページの秘訣は、2 つのテーブルを使用していることです。

<table width="900" class="clean"> <tr> <td align="center">
<br><br>
<table width="880">
    <tr>
        <td width="60" align="left">POSITION</td>
        <td width="40"></td>
        <td width="400" align="left">ARTIST<br>TITLE</td>
        <td width="90" align="center">LAST<br>WEEK</td>
        <td width="90" align="center">HIGHEST<br>POSITION</td>
        <td width="90" align="center">WEEK</td>
        <td width="40" align="center">COVER</td>
        <td width="70" align="right">SHOP</td>
    </tr>
</table>
<hr>

<table width="880" align="center">
...

誰かアイデアがありますか?

4

0 に答える 0