duanqiao3608 2012-06-06 02:41
浏览 45
已采纳

从一个大的html变量中获取一个字符串[重复]

Possible Duplicate:
How to parse and process HTML with PHP?

How would I go about getting a certain string from a webpage that has been scraped? I am using SimpleBrowser in PHP to download a webpage into a variable.

The resultant webpage at a certain part has the following:

    <tr>
        <td class="label" width="350">POD Receiver Name:&nbsp;</td>
        <td class="field" align="left">
            <b>KRISTY</b>&nbsp;
        </td>
    </tr>

I want to get the value KRISTY into a variable, but not really sure how. I have no real experience with regex so I wouldnt know where to start.

Any help appreciated!

  • 写回答

3条回答 默认 最新

  • dq1685513999 2012-06-06 03:05
    关注

    To pull one specific part out from a known location, I'd use xpath. Try a tutorial such as http://ditio.net/2008/12/01/php-xpath-tutorial-advanced-xml-part-1/

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 做个有关计算的小程序
  • ¥15 MPI读取tif文件无法正常给各进程分配路径
  • ¥15 如何用MATLAB实现以下三个公式(有相互嵌套)
  • ¥30 关于#算法#的问题:运用EViews第九版本进行一系列计量经济学的时间数列数据回归分析预测问题 求各位帮我解答一下
  • ¥15 setInterval 页面闪烁,怎么解决
  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化