爆炸抓取页面php curl获取行值

时间:2014-04-12 22:04:27

标签: php html curl explode

我已经从网页抓取了一个页面并将其保存在我的变量$result中。现在我想爆炸它因为我只想从包含我需要的信息的所有页面获得1行。这是我抓住的HTML代码示例。

<pre>
.....
<tr class="altRowItem">

    <td class="center"></td>
    <td class="center"></td>
    <td class="center"></td>
    <td class="fareCol1"></td>
    <td class="fareCol2">
        <p>
            <input id="ControlGroupScheduleSelectView_AvailabilityInputScheduleSelectView_RadioButtonMkt1Fare4" type="radio" value="0~A~~A~RGFR~~1~X|QG~9743~ ~~CGK~04/18/2014 13:10~DPS~04/18/2014 15:55~" name="ControlGroupScheduleSelectView$AvailabilityInputScheduleSelectView$market1"></input>

            Rp.1,137,000
        </p>
    </td>
</tr>
.....
</pre>

我只需要从<p></p>的字符串。这是我使用的代码。

$arrayResult[] = explode("<td class='fareCol2'>", $result);
echo $arrayResult[1];

$arrayResult[1]中没有任何内容。任何人都可以帮助我吗?

1 个答案:

答案 0 :(得分:0)

不需要[],也匹配引号格式

$arrayResult = explode( '<td class="fareCol2">', $result);
相关问题