-1
<div class="divHeaderContainer1">
<table width="488" cellspacing="0" cellpadding="0" height="63">
<tbody>
<tr>
<td height="61">
<a href="jobs/jobdetails.php?recordID=5300"> Job Vacancy For Media and Production      Officer At The International Committee of the Red Cross (ICRC)&nbsp; </a>
<div class="jobDate">posted on 2013-05-10&nbsp;&nbsp;|&nbsp;by Admin |&nbsp;0  comments&nbsp;|&nbsp; 379 views </div>
</td>
</tr>
</tbody>
</table>
</div>

以下のコードを使用して、Web サイト (www.employmentng.com) から href 属性を取得しようとしましたが、何も返されませんでした。

$url='http://www.employmentng.com/index.php?pageNum_Jobs=1&totalRows_Jobs=5127';
$html = file_get_html($url);

foreach($html->find('div[class=divHeaderContainer1]') as $container){
    foreach($html->find('table td[height]') as $table){
        foreach($table->find('a') as $link{
            echo $link-href;
        }

    }
}

これについて助けが必要です

4

1 に答える 1

0

そこに構文エラーがあります。おそらくエラー報告はオフになっているので、

行を変更

foreach($table->find('a') as $link{

行に

foreach($table->find('a') as $link) {

編集:

そこにもう1つのエラーがあります:

echo $link-href;
echo $link->href;
于 2013-05-13T10:28:23.210 に答える