且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用PHP简单的HTML DOM获取隐藏的输入标记值作为字符串

更新时间:2023-11-02 16:20:46

我尝试了代码,这对我来说认为您的$ data-> find不正确:

I tried the code and this works for me, I think your $data->find is not correct:

include('../simple_html_dom.php');


  $seed = 'https://www.bu.edu/link/bin/uiscgi_studentlink.pl/1346752597?ModuleName=univschr.pl&SearchOptionDesc=Class+Subject&SearchOptionCd=C&KeySem=20133&ViewSem=Fall+2012&Subject=&MtgDay=&MtgTime=';
  web_scrape($seed);

  function web_scrape($url)
{
   $data = file_get_html($url);
    //$data = new simple_html_dom();  
   // $data->load_file($url);
    $nodes = $data->find("input[type=hidden]");

    foreach ($nodes as $node) {
    $val = $node->value;
    echo $val . "<br />";
    }

}